Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix potentially passing null to events where IUser is expected
Signed-off-by: Arthur Schiwon <[email protected]>
  • Loading branch information
blizzz authored and backportbot[bot] committed Nov 2, 2020
commit a7bda761f796ad3a997b27aa7595d6bf45e4d517
9 changes: 7 additions & 2 deletions apps/user_ldap/lib/Jobs/UpdateGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\ILogger;
use OCP\IUser;
use OCP\IUserManager;
use Psr\Log\LoggerInterface;

Expand Down Expand Up @@ -120,7 +121,9 @@ private static function handleKnownGroups($groups) {
$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}',
[
Expand All @@ -133,7 +136,9 @@ private static function handleKnownGroups($groups) {
}
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}',
[
Expand Down