Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2020-07-01 11:13:34 +0300
committerGitHub <noreply@github.com>2020-07-01 11:13:34 +0300
commit2d2b41300a4817412735932efe9292fd59dda764 (patch)
tree65e744ad92f8de91b7ecc13ed803bcd5926d64c5 /lib
parentdcc2938429858a706e2c32670a372e298a077f1d (diff)
parent0d86989706847460764ada12ed094dd54955fdcb (diff)
Merge pull request #21539 from nextcloud/backport/21452/stable18
[stable18] Fix autocomplete for LDAP with `shareapi_only_share_with_group_members` on
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Collaboration/Collaborators/UserPlugin.php18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php
index 5fb278fc5ff..c92f7bb0b6e 100644
--- a/lib/private/Collaboration/Collaborators/UserPlugin.php
+++ b/lib/private/Collaboration/Collaborators/UserPlugin.php
@@ -31,7 +31,6 @@ use OCP\Collaboration\Collaborators\ISearchPlugin;
use OCP\Collaboration\Collaborators\ISearchResult;
use OCP\Collaboration\Collaborators\SearchResultType;
use OCP\IConfig;
-use OCP\IGroup;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager;
@@ -68,14 +67,14 @@ class UserPlugin implements ISearchPlugin {
$users = [];
$hasMoreResults = false;
- $userGroups = [];
+ $currentUserGroups = $this->groupManager->getUserGroupIds($this->userSession->getUser());
if ($this->shareWithGroupOnly) {
// Search in all the groups this user is part of
- $userGroups = $this->groupManager->getUserGroups($this->userSession->getUser());
- foreach ($userGroups as $userGroup) {
- $usersInGroup = $userGroup->searchDisplayName($search, $limit, $offset);
- foreach ($usersInGroup as $user) {
- $users[$user->getUID()] = $user;
+ foreach ($currentUserGroups as $userGroupId) {
+ $usersInGroup = $this->groupManager->displayNamesInGroup($userGroupId, $search, $limit, $offset);
+ foreach ($usersInGroup as $userId => $displayName) {
+ $userId = (string) $userId;
+ $users[$userId] = $this->userManager->get($userId);
}
}
} else {
@@ -136,10 +135,7 @@ class UserPlugin implements ISearchPlugin {
if ($this->shareWithGroupOnly) {
// Only add, if we have a common group
- $userGroupIds = array_map(function(IGroup $group) {
- return $group->getGID();
- }, $userGroups);
- $commonGroups = array_intersect($userGroupIds, $this->groupManager->getUserGroupIds($user));
+ $commonGroups = array_intersect($currentUserGroups, $this->groupManager->getUserGroupIds($user));
$addUser = !empty($commonGroups);
}