diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-01-17 13:49:18 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2018-01-17 13:49:18 +0100 |
commit | 6fdd6861118f55a9e740552b82382f55e9415eea (patch) | |
tree | 240878b5cc10662a963e1abcb47feaef6678dd32 /lib/private/Collaboration | |
parent | 3784fa2074ba411860e2986b7b324f4c93ca899e (diff) | |
download | nextcloud-server-6fdd6861118f55a9e740552b82382f55e9415eea.tar.gz nextcloud-server-6fdd6861118f55a9e740552b82382f55e9415eea.zip |
do not offer the handle of the current user for auto completion
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib/private/Collaboration')
-rw-r--r-- | lib/private/Collaboration/Collaborators/Search.php | 9 | ||||
-rw-r--r-- | lib/private/Collaboration/Collaborators/UserPlugin.php | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/private/Collaboration/Collaborators/Search.php b/lib/private/Collaboration/Collaborators/Search.php index e9b15dd1201..0e856eeb6f1 100644 --- a/lib/private/Collaboration/Collaborators/Search.php +++ b/lib/private/Collaboration/Collaborators/Search.php @@ -40,6 +40,15 @@ class Search implements ISearch { $this->c = $c; } + /** + * @param $search + * @param array $shareTypes + * @param $lookup + * @param $limit + * @param $offset + * @return array + * @throws \OCP\AppFramework\QueryException + */ public function search($search, array $shareTypes, $lookup, $limit, $offset) { $hasMoreResults = false; diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php index 86a55aa428f..ad677703547 100644 --- a/lib/private/Collaboration/Collaborators/UserPlugin.php +++ b/lib/private/Collaboration/Collaborators/UserPlugin.php @@ -83,6 +83,8 @@ class UserPlugin implements ISearchPlugin { } } + $this->takeOutCurrentUser($users); + if (!$this->shareeEnumeration || sizeof($users) < $limit) { $hasMoreResults = true; } @@ -146,4 +148,13 @@ class UserPlugin implements ISearchPlugin { return $hasMoreResults; } + + public function takeOutCurrentUser(array &$users) { + $currentUser = $this->userSession->getUser(); + if(!is_null($currentUser)) { + if (isset($users[$currentUser->getUID()])) { + unset($users[$currentUser->getUID()]); + } + } + } } |