From f7185d8497b9e7317e1a4d98a8e8d9bfd8364510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 17 Oct 2024 15:44:42 +0200 Subject: [PATCH] fix(provisioning_api): Fix getting disabled users for group admins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- apps/provisioning_api/lib/Controller/UsersController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php index b0ddd4329af20..7c97641405f6b 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -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 = [];