Loading Dockerfile +2 −1 Original line number Diff line number Diff line Loading @@ -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 -p1 < ${TMP_PATCH_DIR}/036-user-config-change-event.patch RUN rm -rf ${TMP_PATCH_DIR} # Custom theme Loading patches/036-user-config-change-event.patch 0 → 100644 +133 −0 Original line number Diff line number Diff line --- ./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', --- /dev/null 2024-04-16 13:44:50 +++ ./lib/public/User/Events/UserConfigChangedEvent.php 2024-04-16 13:43:17 @@ -0,0 +1,69 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2023 Murena SAS <akhil.potukuchi.ext@murena.com> + * + * @author Murena SAS <akhil.potukuchi.ext@murena.com> + * + * @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 <http://www.gnu.org/licenses/>. + * + */ + +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; + } +} Loading
Dockerfile +2 −1 Original line number Diff line number Diff line Loading @@ -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 -p1 < ${TMP_PATCH_DIR}/036-user-config-change-event.patch RUN rm -rf ${TMP_PATCH_DIR} # Custom theme Loading
patches/036-user-config-change-event.patch 0 → 100644 +133 −0 Original line number Diff line number Diff line --- ./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', --- /dev/null 2024-04-16 13:44:50 +++ ./lib/public/User/Events/UserConfigChangedEvent.php 2024-04-16 13:43:17 @@ -0,0 +1,69 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2023 Murena SAS <akhil.potukuchi.ext@murena.com> + * + * @author Murena SAS <akhil.potukuchi.ext@murena.com> + * + * @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 <http://www.gnu.org/licenses/>. + * + */ + +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; + } +}