From 556440471a882cd47721777c59881ee3aae69c11 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 1 May 2020 16:27:44 +0200 Subject: [PATCH 1/2] Properly search for users when limittogroups is enabled Searching just for the uid is not enough. This makes sure this done properly again now. Signed-off-by: Roeland Jago Douma --- lib/private/Collaboration/Collaborators/UserPlugin.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php index 123fa73144..3566abf0a0 100644 --- a/lib/private/Collaboration/Collaborators/UserPlugin.php +++ b/lib/private/Collaboration/Collaborators/UserPlugin.php @@ -79,7 +79,15 @@ class UserPlugin implements ISearchPlugin { $usersInGroup = $this->groupManager->displayNamesInGroup($userGroupId, $search, $limit, $offset); foreach ($usersInGroup as $userId => $displayName) { $userId = (string) $userId; - $users[$userId] = $this->userManager->get($userId); + $user = $this->userManager->get($userId); + if (!$user->isEnabled()) { + // Ignore disabled users + continue; + } + $users[$userId] = $user; + } + if (count($usersInGroup) >= $limit) { + $hasMoreResults = true; } } } else { From f8955b70925942808f4e7612fed793bfc0c60d36 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 20 Aug 2020 18:24:09 +0200 Subject: [PATCH 2/2] In case the group backend returns $limit or more results it is expected to contain more results Signed-off-by: Morris Jobke --- tests/lib/Collaboration/Collaborators/UserPluginTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php index 40813c8285..49a360e033 100644 --- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php @@ -321,7 +321,7 @@ class UserPluginTest extends TestCase { ['label' => 'Test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']], ['label' => 'Test Two', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']], ], - false, + true, false, [ ['test1', $this->getUserMock('test1', 'Test One')],