Merge pull request #20772 from nextcloud/fix/sharee-integration-test

Properly search for users when limittogroups is enabled
This commit is contained in:
Morris Jobke 2020-08-21 13:18:47 +02:00 committed by GitHub
commit 8261d7e07f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -95,7 +95,15 @@ class UserPlugin implements ISearchPlugin {
$usersInGroup = $this->groupManager->displayNamesInGroup($userGroupId, $search, $limit, $offset); $usersInGroup = $this->groupManager->displayNamesInGroup($userGroupId, $search, $limit, $offset);
foreach ($usersInGroup as $userId => $displayName) { foreach ($usersInGroup as $userId => $displayName) {
$userId = (string) $userId; $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 { } else {

View File

@ -328,7 +328,7 @@ class UserPluginTest extends TestCase {
['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1'], 'status' => []], ['label' => 'Test One', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test1'], 'status' => []],
['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2'], 'status' => []], ['label' => 'Test Two', 'value' => ['shareType' => IShare::TYPE_USER, 'shareWith' => 'test2'], 'status' => []],
], ],
false, true,
false, false,
[ [
['test1', $this->getUserMock('test1', 'Test One')], ['test1', $this->getUserMock('test1', 'Test One')],