diff options
Diffstat (limited to 'settings/Application.php')
-rw-r--r-- | settings/Application.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/settings/Application.php b/settings/Application.php index 111cb6a6e0b..b76ebda403f 100644 --- a/settings/Application.php +++ b/settings/Application.php @@ -33,6 +33,8 @@ use OC\AppFramework\Utility\TimeFactory; use OC\Authentication\Token\IProvider; use OC\Authentication\Token\IToken; use OC\Server; +use OC\Settings\Activity\GroupProvider; +use OC\Settings\Activity\GroupSetting; use OC\Settings\Activity\Provider; use OC\Settings\Activity\SecurityFilter; use OC\Settings\Activity\SecurityProvider; @@ -44,7 +46,9 @@ use OCP\Activity\IManager as IActivityManager; use OCP\AppFramework\App; use OCP\Defaults; use OCP\IContainer; +use OCP\IGroup; use OCP\ILogger; +use OCP\IUser; use OCP\Settings\IManager; use OCP\Util; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -149,13 +153,32 @@ class Application extends App { $activityManager->registerFilter(SecurityFilter::class); // FIXME move to info.xml $activityManager->registerSetting(SecuritySetting::class); // FIXME move to info.xml $activityManager->registerProvider(SecurityProvider::class); // FIXME move to info.xml + $activityManager->registerSetting(GroupSetting::class); // FIXME move to info.xml + $activityManager->registerProvider(GroupProvider::class); // FIXME move to info.xml Util::connectHook('OC_User', 'post_setPassword', $this, 'onChangePassword'); Util::connectHook('OC_User', 'changeUser', $this, 'onChangeInfo'); + $groupManager = $this->getContainer()->getServer()->getGroupManager(); + $groupManager->listen('\OC\Group', 'postRemoveUser', [$this, 'removeUserFromGroup']); + $groupManager->listen('\OC\Group', 'postAddUser', [$this, 'addUserToGroup']); + Util::connectHook('\OCP\Config', 'js', $this, 'extendJsConfig'); } + public function addUserToGroup(IGroup $group, IUser $user): void { + /** @var Hooks $hooks */ + $hooks = $this->getContainer()->query(Hooks::class); + $hooks->addUserToGroup($group, $user); + + } + + public function removeUserFromGroup(IGroup $group, IUser $user): void { + /** @var Hooks $hooks */ + $hooks = $this->getContainer()->query(Hooks::class); + $hooks->removeUserFromGroup($group, $user); + } + /** * @param array $parameters * @throws \InvalidArgumentException |