diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-08-21 13:18:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-21 13:18:47 +0200 |
commit | 8261d7e07f14c018c8e365767eafb23a9390958d (patch) | |
tree | cf52fe9fd1aba987bbfe18c5bb92e2c03454b7a5 | |
parent | 7c30b612bd704b5dfebc7af4280915035d8447a8 (diff) | |
parent | a0cbf16d9be06249c5f5d35d06975fa36bc4b304 (diff) | |
download | nextcloud-server-8261d7e07f14c018c8e365767eafb23a9390958d.tar.gz nextcloud-server-8261d7e07f14c018c8e365767eafb23a9390958d.zip |
Merge pull request #20772 from nextcloud/fix/sharee-integration-test
Properly search for users when limittogroups is enabled
-rw-r--r-- | lib/private/Collaboration/Collaborators/UserPlugin.php | 10 | ||||
-rw-r--r-- | tests/lib/Collaboration/Collaborators/UserPluginTest.php | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php index 72368e50521..0a603448525 100644 --- a/lib/private/Collaboration/Collaborators/UserPlugin.php +++ b/lib/private/Collaboration/Collaborators/UserPlugin.php @@ -95,7 +95,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 { diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php index 0db370d68b1..cf2298d42f2 100644 --- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php @@ -328,7 +328,7 @@ class UserPluginTest extends TestCase { ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1'], 'status' => []], ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2'], 'status' => []], ], - false, + true, false, [ ['test1', $this->getUserMock('test1', 'Test One')], |