Skip to content

Commit

Permalink
Merge pull request #36784 from nextcloud/fix/user_ldap-update-groups-…
Browse files Browse the repository at this point in the history
…fail-get

Properly test and log when a group is not found
  • Loading branch information
kesselb authored Apr 24, 2023
2 parents 4953296 + 0186194 commit 2abefff
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion apps/user_ldap/lib/Jobs/UpdateGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
use Psr\Log\LoggerInterface;

class UpdateGroups extends TimedJob {
/** @var ?array<string, array{owncloudusers: string, owncloudname: string}> */
/** @var ?array<string, array{owncloudusers: string, owncloudname: string}> */
private ?array $groupsFromDB = null;
private Group_Proxy $groupBackend;
private IEventDispatcher $dispatcher;
Expand Down Expand Up @@ -157,6 +157,17 @@ private function handleKnownGroups(array $groups): void {
$hasChanged = false;

$groupObject = $this->groupManager->get($group);
if ($groupObject === null) {
/* We are not expecting the group to not be found since it was returned by $this->groupBackend->getGroups() */
$this->logger->error(
'bgJ "updateGroups" – Failed to get group {group} for update',
[
'app' => 'user_ldap',
'group' => $group
]
);
continue;
}
foreach (array_diff($knownUsers, $actualUsers) as $removedUser) {
$userObject = $this->userManager->get($removedUser);
if ($userObject instanceof IUser) {
Expand Down

0 comments on commit 2abefff

Please sign in to comment.