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;
* @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();
$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);