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 susnux committed Oct 30, 2024
1 parent 40c2764 commit 9a39989
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 @@ -277,21 +277,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 9a39989

Please sign in to comment.