From dc3bd8a986f573bf61e7f8ca850ae3ff9a27f524 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 15 Apr 2024 16:18:05 +0000 Subject: [PATCH 01/11] Update Dockerfile --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b393155a..d7cd86f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -150,7 +150,8 @@ RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/3rdparty/sabre/vobject/lib/ITip/Broke RUN patch -u ${BASE_DIR}/apps/theming/lib/Themes/CommonThemeTrait.php -i ${TMP_PATCH_DIR}/026-primary-color-fix.patch RUN patch -u ${BASE_DIR}/lib/private/Template/JSResourceLocator.php -i ${TMP_PATCH_DIR}/031-theme-custom-app-translations.patch RUN patch -u ${BASE_DIR}/lib/private/L10N/Factory.php -i ${TMP_PATCH_DIR}/032-select-lang-from-session.patch - +# UserConfigChangedEvent Ref: https://github.com/nextcloud/server/pull/42039 +RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/035-user-config-change-event.patch RUN rm -rf ${TMP_PATCH_DIR} # Custom theme -- GitLab From e04e42f2b6423bb8839c341b678e6412c6c97555 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 15 Apr 2024 16:19:35 +0000 Subject: [PATCH 02/11] Add new file --- patches/035-user-config-change-event.patch | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 patches/035-user-config-change-event.patch diff --git a/patches/035-user-config-change-event.patch b/patches/035-user-config-change-event.patch new file mode 100644 index 00000000..54490665 --- /dev/null +++ b/patches/035-user-config-change-event.patch @@ -0,0 +1,59 @@ +--- ./lib/private/AllConfig.php 2024-03-28 01:02:39 ++++ ./lib/private/AllConfig-new.php 2024-04-15 16:36:23 +@@ -38,6 +38,8 @@ + use OCP\IConfig; + use OCP\IDBConnection; + use OCP\PreConditionNotMetException; ++use OCP\EventDispatcher\IEventDispatcher; ++use OCP\User\Events\UserConfigChangedEvent; + + /** + * Class to combine all the configuration options ownCloud offers +@@ -278,6 +280,7 @@ + $qb->executeStatement(); + + $this->userCache[$userId][$appName][$key] = (string)$value; ++ $this->triggerUserValueChange($userId, $appName, $key, $value, $prevValue); + return; + } + } +@@ -304,8 +307,15 @@ + } + $this->userCache[$userId][$appName][$key] = (string)$value; + } ++ $this->triggerUserValueChange($userId, $appName, $key, $value, $prevValue); + } + ++ private function triggerUserValueChange($userId, $appId, $key, $value, $oldValue = null) { ++ if (\OC::$server instanceof \OCP\IServerContainer) { ++ $dispatcher = \OC::$server->get(IEventDispatcher::class); ++ $dispatcher->dispatchTyped(new UserConfigChangedEvent($userId, $appId, $key, $value, $oldValue)); ++ } ++ } + /** + * Getting a user defined value + * + + +--- ./lib/composer/composer/autoload_static.php 2024-03-28 01:02:39 ++++ ./lib/composer/composer/autoload_static-new.php 2024-04-15 16:34:18 +@@ -710,6 +710,7 @@ + 'OCP\\User\\Events\\PasswordUpdatedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/PasswordUpdatedEvent.php', + 'OCP\\User\\Events\\PostLoginEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/PostLoginEvent.php', + 'OCP\\User\\Events\\UserChangedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserChangedEvent.php', ++ 'OCP\\User\\Events\\UserConfigChangedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserConfigChangedEvent.php', + 'OCP\\User\\Events\\UserCreatedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserCreatedEvent.php', + 'OCP\\User\\Events\\UserDeletedEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserDeletedEvent.php', + 'OCP\\User\\Events\\UserLiveStatusEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserLiveStatusEvent.php', + + +--- ./lib/composer/composer/autoload_classmap.php 2024-03-28 01:02:39 ++++ ./lib/composer/composer/autoload_classmap-new.php 2024-04-15 16:33:19 +@@ -683,6 +683,7 @@ + 'OCP\\User\\Events\\UserLoggedInEvent' => $baseDir . '/lib/public/User/Events/UserLoggedInEvent.php', + 'OCP\\User\\Events\\UserLoggedInWithCookieEvent' => $baseDir . '/lib/public/User/Events/UserLoggedInWithCookieEvent.php', + 'OCP\\User\\Events\\UserLoggedOutEvent' => $baseDir . '/lib/public/User/Events/UserLoggedOutEvent.php', ++ 'OCP\\User\\Events\\UserConfigChangedEvent' => $baseDir . '/lib/public/User/Events/UserConfigChangedEvent.php', + 'OCP\\User\\GetQuotaEvent' => $baseDir . '/lib/public/User/GetQuotaEvent.php', + 'OCP\\Util' => $baseDir . '/lib/public/Util.php', + 'OCP\\WorkflowEngine\\EntityContext\\IContextPortation' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IContextPortation.php', -- GitLab From b90df0c3e0483250dcff805855954df3fd1c7d6b Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 16 Apr 2024 08:05:36 +0000 Subject: [PATCH 03/11] Add new file --- ...6-user-config-changed-event-new-file.patch | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 patches/036-user-config-changed-event-new-file.patch diff --git a/patches/036-user-config-changed-event-new-file.patch b/patches/036-user-config-changed-event-new-file.patch new file mode 100644 index 00000000..9b9d664b --- /dev/null +++ b/patches/036-user-config-changed-event-new-file.patch @@ -0,0 +1,70 @@ +--- /dev/null ++++ ./lib/public/User/Events/UserConfigChangedEvent.php +@@ -0,0 +1 @@ ++ ++ * ++ * @author Murena SAS ++ * ++ * @license GNU AGPL version 3 or any later version ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU Affero General Public License as ++ * published by the Free Software Foundation, either version 3 of the ++ * License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Affero General Public License for more details. ++ * ++ * You should have received a copy of the GNU Affero General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++namespace OCP\User\Events; ++ ++use OCP\EventDispatcher\Event; ++ ++class UserConfigChangedEvent extends Event { ++ private string $userId; ++ private string $appId; ++ private string $key; ++ private mixed $value; ++ private mixed $oldValue; ++ ++ public function __construct(string $userId, string $appId, string $key, mixed $value, mixed $oldValue = null) { ++ parent::__construct(); ++ $this->userId = $userId; ++ $this->appId = $appId; ++ $this->key = $key; ++ $this->value = $value; ++ $this->oldValue = $oldValue; ++ } ++ ++ public function getUserId(): string { ++ return $this->userId; ++ } ++ ++ public function getAppId(): string { ++ return $this->appId; ++ } ++ ++ public function getKey(): string { ++ return $this->key; ++ } ++ ++ public function getValue() { ++ return $this->value; ++ } ++ ++ public function getOldValue() { ++ return $this->oldValue; ++ } ++} +\ No newline at end of file -- GitLab From 24f41afa102f8a9b29fcee897df08623461ffb8c Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 16 Apr 2024 08:06:32 +0000 Subject: [PATCH 04/11] Update Dockerfile --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d7cd86f9..0b790a95 100644 --- a/Dockerfile +++ b/Dockerfile @@ -151,7 +151,8 @@ RUN patch -u ${BASE_DIR}/apps/theming/lib/Themes/CommonThemeTrait.php -i ${TMP_P RUN patch -u ${BASE_DIR}/lib/private/Template/JSResourceLocator.php -i ${TMP_PATCH_DIR}/031-theme-custom-app-translations.patch RUN patch -u ${BASE_DIR}/lib/private/L10N/Factory.php -i ${TMP_PATCH_DIR}/032-select-lang-from-session.patch # UserConfigChangedEvent Ref: https://github.com/nextcloud/server/pull/42039 -RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/035-user-config-change-event.patch +RUN cd ${BASE_DIR} && patch -p1 < ${TMP_PATCH_DIR}/035-user-config-change-event.patch +RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/036-user-config-changed-event-new-file.patch RUN rm -rf ${TMP_PATCH_DIR} # Custom theme -- GitLab From bf826f9bbdf41a560ead7b9338a2673c044614e5 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 16 Apr 2024 08:16:32 +0000 Subject: [PATCH 05/11] Update 036-user-config-changed-event-new-file.patch --- ...6-user-config-changed-event-new-file.patch | 68 ++++++++++--------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/patches/036-user-config-changed-event-new-file.patch b/patches/036-user-config-changed-event-new-file.patch index 9b9d664b..f6d60cbf 100644 --- a/patches/036-user-config-changed-event-new-file.patch +++ b/patches/036-user-config-changed-event-new-file.patch @@ -1,6 +1,6 @@ ---- /dev/null -+++ ./lib/public/User/Events/UserConfigChangedEvent.php -@@ -0,0 +1 @@ +--- /dev/null 2024-04-16 13:44:50 ++++ ./lib/public/User/Events/UserConfigChangedEvent.php 2024-04-16 13:43:17 +@@ -0,0 +1,69 @@ +userId = $userId; -+ $this->appId = $appId; -+ $this->key = $key; -+ $this->value = $value; -+ $this->oldValue = $oldValue; -+ } ++ public function __construct(string $userId, ++ string $appId, ++ string $key, ++ mixed $value, ++ mixed $oldValue = null) { ++ parent::__construct(); ++ $this->userId = $userId; ++ $this->appId = $appId; ++ $this->key = $key; ++ $this->value = $value; ++ $this->oldValue = $oldValue; ++ } + -+ public function getUserId(): string { -+ return $this->userId; -+ } ++ public function getUserId(): string { ++ return $this->userId; ++ } + -+ public function getAppId(): string { -+ return $this->appId; -+ } ++ public function getAppId(): string { ++ return $this->appId; ++ } ++ public function getKey(): string { ++ return $this->key; ++ } + -+ public function getKey(): string { -+ return $this->key; -+ } ++ public function getValue() { ++ return $this->value; ++ } + -+ public function getValue() { -+ return $this->value; -+ } -+ -+ public function getOldValue() { -+ return $this->oldValue; -+ } ++ public function getOldValue() { ++ return $this->oldValue; ++ } +} -\ No newline at end of file -- GitLab From cdbd61852cbe4d1bf8e150702b8a160229e9ea49 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Fri, 19 Apr 2024 06:07:05 +0000 Subject: [PATCH 06/11] Update 035-user-config-change-event.patch --- ...nfig-change-event.patch => 036-user-config-change-event.patch} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename patches/{035-user-config-change-event.patch => 036-user-config-change-event.patch} (100%) diff --git a/patches/035-user-config-change-event.patch b/patches/036-user-config-change-event.patch similarity index 100% rename from patches/035-user-config-change-event.patch rename to patches/036-user-config-change-event.patch -- GitLab From 12f7e66244363f47b82d0bfed2ebb2001bdd0140 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Fri, 19 Apr 2024 06:07:25 +0000 Subject: [PATCH 07/11] Update 036-user-config-changed-event-new-file.patch --- ...ew-file.patch => 037-user-config-changed-event-new-file.patch} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename patches/{036-user-config-changed-event-new-file.patch => 037-user-config-changed-event-new-file.patch} (100%) diff --git a/patches/036-user-config-changed-event-new-file.patch b/patches/037-user-config-changed-event-new-file.patch similarity index 100% rename from patches/036-user-config-changed-event-new-file.patch rename to patches/037-user-config-changed-event-new-file.patch -- GitLab From d2f34d46aa6adde401bc099d7fe3b8d353815e99 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Fri, 19 Apr 2024 06:08:20 +0000 Subject: [PATCH 08/11] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0b790a95..daa887c1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -151,8 +151,8 @@ RUN patch -u ${BASE_DIR}/apps/theming/lib/Themes/CommonThemeTrait.php -i ${TMP_P RUN patch -u ${BASE_DIR}/lib/private/Template/JSResourceLocator.php -i ${TMP_PATCH_DIR}/031-theme-custom-app-translations.patch RUN patch -u ${BASE_DIR}/lib/private/L10N/Factory.php -i ${TMP_PATCH_DIR}/032-select-lang-from-session.patch # UserConfigChangedEvent Ref: https://github.com/nextcloud/server/pull/42039 -RUN cd ${BASE_DIR} && patch -p1 < ${TMP_PATCH_DIR}/035-user-config-change-event.patch -RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/036-user-config-changed-event-new-file.patch +RUN cd ${BASE_DIR} && patch -p1 < ${TMP_PATCH_DIR}/036-user-config-change-event.patch +RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/037-user-config-changed-event-new-file.patch RUN rm -rf ${TMP_PATCH_DIR} # Custom theme -- GitLab From 597c8f8a9580c723cdc56c05431be01ca832fef6 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Fri, 19 Apr 2024 06:13:07 +0000 Subject: [PATCH 09/11] Delete 037-user-config-changed-event-new-file.patch --- ...7-user-config-changed-event-new-file.patch | 72 ------------------- 1 file changed, 72 deletions(-) delete mode 100644 patches/037-user-config-changed-event-new-file.patch diff --git a/patches/037-user-config-changed-event-new-file.patch b/patches/037-user-config-changed-event-new-file.patch deleted file mode 100644 index f6d60cbf..00000000 --- a/patches/037-user-config-changed-event-new-file.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- /dev/null 2024-04-16 13:44:50 -+++ ./lib/public/User/Events/UserConfigChangedEvent.php 2024-04-16 13:43:17 -@@ -0,0 +1,69 @@ -+ -+ * -+ * @author Murena SAS -+ * -+ * @license GNU AGPL version 3 or any later version -+ * -+ * This program is free software: you can redistribute it and/or modify -+ * it under the terms of the GNU Affero General Public License as -+ * published by the Free Software Foundation, either version 3 of the -+ * License, or (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU Affero General Public License for more details. -+ * -+ * You should have received a copy of the GNU Affero General Public License -+ * along with this program. If not, see . -+ * -+ */ -+ -+namespace OCP\User\Events; -+ -+use OCP\EventDispatcher\Event; -+ -+class UserConfigChangedEvent extends Event { -+ private string $userId; -+ private string $appId; -+ private string $key; -+ private mixed $value; -+ private mixed $oldValue; -+ -+ public function __construct(string $userId, -+ string $appId, -+ string $key, -+ mixed $value, -+ mixed $oldValue = null) { -+ parent::__construct(); -+ $this->userId = $userId; -+ $this->appId = $appId; -+ $this->key = $key; -+ $this->value = $value; -+ $this->oldValue = $oldValue; -+ } -+ -+ public function getUserId(): string { -+ return $this->userId; -+ } -+ -+ public function getAppId(): string { -+ return $this->appId; -+ } -+ public function getKey(): string { -+ return $this->key; -+ } -+ -+ public function getValue() { -+ return $this->value; -+ } -+ -+ public function getOldValue() { -+ return $this->oldValue; -+ } -+} -- GitLab From b8f9f4e8b6424ee1b7dbabd116abd6a9a551037d Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Fri, 19 Apr 2024 06:13:37 +0000 Subject: [PATCH 10/11] Update 036-user-config-change-event.patch --- patches/036-user-config-change-event.patch | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/patches/036-user-config-change-event.patch b/patches/036-user-config-change-event.patch index 54490665..2234e3d6 100644 --- a/patches/036-user-config-change-event.patch +++ b/patches/036-user-config-change-event.patch @@ -57,3 +57,77 @@ 'OCP\\User\\GetQuotaEvent' => $baseDir . '/lib/public/User/GetQuotaEvent.php', 'OCP\\Util' => $baseDir . '/lib/public/Util.php', 'OCP\\WorkflowEngine\\EntityContext\\IContextPortation' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IContextPortation.php', + + +--- /dev/null 2024-04-16 13:44:50 ++++ ./lib/public/User/Events/UserConfigChangedEvent.php 2024-04-16 13:43:17 +@@ -0,0 +1,69 @@ ++ ++ * ++ * @author Murena SAS ++ * ++ * @license GNU AGPL version 3 or any later version ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU Affero General Public License as ++ * published by the Free Software Foundation, either version 3 of the ++ * License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Affero General Public License for more details. ++ * ++ * You should have received a copy of the GNU Affero General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++namespace OCP\User\Events; ++ ++use OCP\EventDispatcher\Event; ++ ++class UserConfigChangedEvent extends Event { ++ private string $userId; ++ private string $appId; ++ private string $key; ++ private mixed $value; ++ private mixed $oldValue; ++ ++ public function __construct(string $userId, ++ string $appId, ++ string $key, ++ mixed $value, ++ mixed $oldValue = null) { ++ parent::__construct(); ++ $this->userId = $userId; ++ $this->appId = $appId; ++ $this->key = $key; ++ $this->value = $value; ++ $this->oldValue = $oldValue; ++ } ++ ++ public function getUserId(): string { ++ return $this->userId; ++ } ++ ++ public function getAppId(): string { ++ return $this->appId; ++ } ++ public function getKey(): string { ++ return $this->key; ++ } ++ ++ public function getValue() { ++ return $this->value; ++ } ++ ++ public function getOldValue() { ++ return $this->oldValue; ++ } ++} -- GitLab From dc42c0a303db0828fbd90f3dbdaa830a1dc3ae90 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Fri, 19 Apr 2024 06:14:13 +0000 Subject: [PATCH 11/11] Update Dockerfile --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index daa887c1..19eeed32 100644 --- a/Dockerfile +++ b/Dockerfile @@ -152,7 +152,6 @@ RUN patch -u ${BASE_DIR}/lib/private/Template/JSResourceLocator.php -i ${TMP_PAT RUN patch -u ${BASE_DIR}/lib/private/L10N/Factory.php -i ${TMP_PATCH_DIR}/032-select-lang-from-session.patch # UserConfigChangedEvent Ref: https://github.com/nextcloud/server/pull/42039 RUN cd ${BASE_DIR} && patch -p1 < ${TMP_PATCH_DIR}/036-user-config-change-event.patch -RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/037-user-config-changed-event-new-file.patch RUN rm -rf ${TMP_PATCH_DIR} # Custom theme -- GitLab