Skip to content

Commit

Permalink
fix(provisioning_api): Fix getting disabled users for group admins
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
  • Loading branch information
come-nc authored and backportbot[bot] committed Oct 29, 2024
1 parent b2b1be0 commit f7185d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/provisioning_api/lib/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,21 @@ public function getDisabledUsersDetails(string $search = '', ?int $limit = null,
/* We have to handle offset ourselve for correctness */
$tempLimit = ($limit === null ? null : $limit + $offset);
foreach ($subAdminOfGroups as $group) {
$users = array_merge(
$users = array_unique(array_merge(
$users,
array_map(
fn (IUser $user): string => $user->getUID(),
array_filter(
$group->searchUsers($search, ($tempLimit === null ? null : $tempLimit - count($users))),
$group->searchUsers($search),
fn (IUser $user): bool => !$user->isEnabled()
)
)
);
));
if (($tempLimit !== null) && (count($users) >= $tempLimit)) {
break;
}
}
$users = array_slice($users, $offset);
$users = array_slice($users, $offset, $limit);
}

$usersDetails = [];
Expand Down

0 comments on commit f7185d8

Please sign in to comment.