diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2020-09-10 12:57:10 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2020-09-10 12:57:10 +0200 |
commit | 263f5bd1d93e20344145fda395d5dab0fa08f4a5 (patch) | |
tree | 8983c4faa83cef14fb7e9b842d2bd27025546211 /apps/user_ldap | |
parent | 04c174ab899a6ba3918c6cfbd535037bc63fd52d (diff) | |
download | nextcloud-server-263f5bd1d93e20344145fda395d5dab0fa08f4a5.tar.gz nextcloud-server-263f5bd1d93e20344145fda395d5dab0fa08f4a5.zip |
switch to typed event for LDAPs user added to group case
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/lib/Jobs/UpdateGroups.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/user_ldap/lib/Jobs/UpdateGroups.php b/apps/user_ldap/lib/Jobs/UpdateGroups.php index a517216113e..8cbac261e9f 100644 --- a/apps/user_ldap/lib/Jobs/UpdateGroups.php +++ b/apps/user_ldap/lib/Jobs/UpdateGroups.php @@ -44,6 +44,7 @@ use OCA\User_LDAP\Mapping\GroupMapping; use OCA\User_LDAP\Mapping\UserMapping; use OCA\User_LDAP\User\Manager; use OCP\EventDispatcher\IEventDispatcher; +use OCP\Group\Events\UserAddedEvent; use OCP\Group\Events\UserRemovedEvent; use OCP\ILogger; @@ -95,6 +96,7 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob { * @param string[] $groups */ private static function handleKnownGroups($groups) { + /** @var IEventDispatcher $dispatcher */ $dispatcher = \OC::$server->query(IEventDispatcher::class); $groupManager = \OC::$server->getGroupManager(); $userManager = \OC::$server->getUserManager(); @@ -121,7 +123,8 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob { $hasChanged = true; } foreach (array_diff($actualUsers, $knownUsers) as $addedUser) { - \OCP\Util::emitHook('OC_User', 'post_addToGroup', ['uid' => $addedUser, 'gid' => $group]); + $userObject = $userManager->get($addedUser); + $dispatcher->dispatchTyped(new UserAddedEvent($groupObject, $userObject)); \OCP\Util::writeLog('user_ldap', 'bgJ "updateGroups" – "'.$addedUser.'" added to "'.$group.'".', ILogger::INFO); |