aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Contacts/ContactsMenu/ContactsStore.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-03-10 17:18:44 +0100
committerJoas Schilling <coding@schilljs.com>2021-03-10 17:25:57 +0100
commit5b53b6f977497c359385ce6b324dfc2c2a68dc90 (patch)
tree2fa5ce189b68b585727761df952f362a17c17fd6 /lib/private/Contacts/ContactsMenu/ContactsStore.php
parent177ae33ba1023dcc2a9c1bfce0e2b551ed7b746d (diff)
downloadnextcloud-server-5b53b6f977497c359385ce6b324dfc2c2a68dc90.tar.gz
nextcloud-server-5b53b6f977497c359385ce6b324dfc2c2a68dc90.zip
Add a setting to restrict returning a full match unless in phonebook or same group
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Contacts/ContactsMenu/ContactsStore.php')
-rw-r--r--lib/private/Contacts/ContactsMenu/ContactsStore.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php
index 852765506c0..e0e0bf832b3 100644
--- a/lib/private/Contacts/ContactsMenu/ContactsStore.php
+++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php
@@ -124,6 +124,7 @@ class ContactsStore implements IContactsStore {
$disallowEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') !== 'yes';
$restrictEnumerationGroup = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_group', 'no') === 'yes';
$restrictEnumerationPhone = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_phone', 'no') === 'yes';
+ $allowEnumerationFullMatch = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match', 'yes') === 'yes';
$excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes';
// whether to filter out local users
@@ -146,7 +147,7 @@ class ContactsStore implements IContactsStore {
$selfUID = $self->getUID();
- return array_values(array_filter($entries, function (IEntry $entry) use ($skipLocal, $ownGroupsOnly, $selfGroups, $selfUID, $disallowEnumeration, $restrictEnumerationGroup, $restrictEnumerationPhone, $filter) {
+ return array_values(array_filter($entries, function (IEntry $entry) use ($skipLocal, $ownGroupsOnly, $selfGroups, $selfUID, $disallowEnumeration, $restrictEnumerationGroup, $restrictEnumerationPhone, $allowEnumerationFullMatch, $filter) {
if ($entry->getProperty('UID') === $selfUID) {
return false;
}
@@ -160,6 +161,10 @@ class ContactsStore implements IContactsStore {
// Prevent enumerating local users
if ($disallowEnumeration) {
+ if (!$allowEnumerationFullMatch) {
+ return false;
+ }
+
$filterUser = true;
$mailAddresses = $entry->getEMailAddresses();