Skip to content

Commit

Permalink
Ignore deactivated users in collaborators user search plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
  • Loading branch information
tcitworld committed Aug 6, 2018
1 parent a311798 commit 03f1fef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/private/Collaboration/Collaborators/UserPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) {
$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();
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion tests/lib/Collaboration/Collaborators/UserPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function instantiatePlugin() {
);
}

public function getUserMock($uid, $displayName) {
public function getUserMock($uid, $displayName, $enabled = true) {
$user = $this->createMock(IUser::class);

$user->expects($this->any())
Expand All @@ -100,6 +100,10 @@ public function getUserMock($uid, $displayName) {
->method('getDisplayName')
->willReturn($displayName);

$user->expects($this->any())
->method('isEnabled')
->willReturn($enabled);

return $user;
}

Expand Down

0 comments on commit 03f1fef

Please sign in to comment.