diff options
author | Joas Schilling <coding@schilljs.com> | 2019-03-04 12:46:59 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-03-04 12:46:59 +0100 |
commit | bd916cc6b2ff8a6d9b256b31706c3db9f2d1bc73 (patch) | |
tree | 15f6c6d51b939e12c347234392fe0771a96bdc88 /settings/Application.php | |
parent | 358c9e649bebdc82424b999e9941c37541e730ea (diff) | |
download | nextcloud-server-bd916cc6b2ff8a6d9b256b31706c3db9f2d1bc73.tar.gz nextcloud-server-bd916cc6b2ff8a6d9b256b31706c3db9f2d1bc73.zip |
Add activities for group membership changes
Signed-off-by: Joas Schilling <coding@schilljs.com>
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 |