]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(provisioning_api): Fix getting disabled users for group admins backport/48766/stable29 48969/head
authorCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 17 Oct 2024 13:44:42 +0000 (15:44 +0200)
committerGit'Fellow <12234510+solracsf@users.noreply.github.com>
Thu, 31 Oct 2024 06:51:26 +0000 (07:51 +0100)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
apps/provisioning_api/lib/Controller/UsersController.php

index 5770ca39bda20dd872a10bd8d5f3de695233e92c..16c436e7f7a5fc0d5e0d670abc3a477aae46b2d8 100644 (file)
@@ -259,21 +259,21 @@ class UsersController extends AUserData {
                        /* 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 = [];