diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2020-10-30 15:38:19 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2020-10-30 16:30:01 +0100 |
commit | 3a51160221fa6ff4dddd9b230668f060603633f1 (patch) | |
tree | 65a5df87f2cd42b0f43d5a396364255002404f9c /apps/user_ldap/lib | |
parent | fd440875303bc04f72abea61459f90e9523399bb (diff) | |
download | nextcloud-server-3a51160221fa6ff4dddd9b230668f060603633f1.tar.gz nextcloud-server-3a51160221fa6ff4dddd9b230668f060603633f1.zip |
fix potentially passing null to events where IUser is expected
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r-- | apps/user_ldap/lib/Jobs/UpdateGroups.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/user_ldap/lib/Jobs/UpdateGroups.php b/apps/user_ldap/lib/Jobs/UpdateGroups.php index 7a4ce93db7d..0ecd43480c4 100644 --- a/apps/user_ldap/lib/Jobs/UpdateGroups.php +++ b/apps/user_ldap/lib/Jobs/UpdateGroups.php @@ -41,6 +41,7 @@ use OCP\Group\Events\UserRemovedEvent; use OCP\IDBConnection; use OCP\IGroupManager; use OCP\ILogger; +use OCP\IUser; use OCP\IUserManager; use Psr\Log\LoggerInterface; @@ -153,7 +154,9 @@ class UpdateGroups extends TimedJob { $groupObject = $this->groupManager->get($group); foreach (array_diff($knownUsers, $actualUsers) as $removedUser) { $userObject = $this->userManager->get($removedUser); - $this->dispatcher->dispatchTyped(new UserRemovedEvent($groupObject, $userObject)); + if ($userObject instanceof IUser) { + $this->dispatcher->dispatchTyped(new UserRemovedEvent($groupObject, $userObject)); + } $this->logger->info( 'bgJ "updateGroups" – {user} removed from {group}', [ @@ -166,7 +169,9 @@ class UpdateGroups extends TimedJob { } foreach (array_diff($actualUsers, $knownUsers) as $addedUser) { $userObject = $this->userManager->get($addedUser); - $this->dispatcher->dispatchTyped(new UserAddedEvent($groupObject, $userObject)); + if ($userObject instanceof IUser) { + $this->dispatcher->dispatchTyped(new UserAddedEvent($groupObject, $userObject)); + } $this->logger->info( 'bgJ "updateGroups" – {user} added to {group}', [ |