aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Collaboration/Collaborators/MailPlugin.php
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-02-18 19:44:18 +0100
committerJulius Härtl <jus@bitgrid.net>2020-03-20 10:43:56 +0100
commitc97ab39acb73941d19f911583b31587cf7b65de2 (patch)
tree5f371187c23433f1d17eadb7a5f73eb2acf348ee /lib/private/Collaboration/Collaborators/MailPlugin.php
parent87393a760eb0eea839699b49c89fb33d6bd08872 (diff)
downloadnextcloud-server-c97ab39acb73941d19f911583b31587cf7b65de2.tar.gz
nextcloud-server-c97ab39acb73941d19f911583b31587cf7b65de2.zip
Limit user search in Collaborators plugins
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/Collaboration/Collaborators/MailPlugin.php')
-rw-r--r--lib/private/Collaboration/Collaborators/MailPlugin.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php
index f4af4737c1a..3a3759b5794 100644
--- a/lib/private/Collaboration/Collaborators/MailPlugin.php
+++ b/lib/private/Collaboration/Collaborators/MailPlugin.php
@@ -65,6 +65,8 @@ class MailPlugin implements ISearchPlugin {
$this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes';
$this->shareWithGroupOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes';
+ $this->shareeEnumerationInGroupOnly = $this->shareeEnumeration && $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_group', 'no') === 'yes';
+
}
/**
@@ -150,7 +152,18 @@ class MailPlugin implements ISearchPlugin {
continue;
}
- if (!$this->isCurrentUser($cloud) && !$searchResult->hasResult($userType, $cloud->getUser())) {
+ $addToWide = !$this->shareeEnumerationInGroupOnly;
+ if ($this->shareeEnumerationInGroupOnly) {
+ $addToWide = false;
+ $userGroups = $this->groupManager->getUserGroupIds($this->userSession->getUser());
+ foreach ($userGroups as $userGroup) {
+ if ($this->groupManager->isInGroup($contact['UID'], $userGroup)) {
+ $addToWide = true;
+ break;
+ }
+ }
+ }
+ if ($addToWide && !$this->isCurrentUser($cloud) && !$searchResult->hasResult($userType, $cloud->getUser())) {
$userResults['wide'][] = [
'label' => $displayName,
'uuid' => $contact['UID'],
@@ -160,6 +173,7 @@ class MailPlugin implements ISearchPlugin {
'shareWith' => $cloud->getUser(),
],
];
+ continue;
}
}
continue;