Ignore deactivated users in collaborators user search plugin

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2018-08-06 09:55:24 +02:00
parent a311798674
commit 03f1fef160
2 changed files with 8 additions and 2 deletions

View file

@ -79,7 +79,9 @@ class UserPlugin implements ISearchPlugin {
$usersTmp = $this->userManager->searchDisplayName($search, $limit, $offset);
foreach ($usersTmp as $user) {
$users[$user->getUID()] = $user->getDisplayName();
if ($user->isEnabled()) { // Don't keep deactivated users
$users[$user->getUID()] = $user->getDisplayName();
}
}
}

View file

@ -89,7 +89,7 @@ class UserPluginTest extends TestCase {
);
}
public function getUserMock($uid, $displayName) {
public function getUserMock($uid, $displayName, $enabled = true) {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
@ -100,6 +100,10 @@ class UserPluginTest extends TestCase {
->method('getDisplayName')
->willReturn($displayName);
$user->expects($this->any())
->method('isEnabled')
->willReturn($enabled);
return $user;
}