aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Contacts
diff options
context:
space:
mode:
authorCorentin Damman <c.damman@intopix.com>2022-09-16 17:43:01 +0200
committerskjnldsv <skjnldsv@protonmail.com>2024-03-15 16:52:59 +0100
commit0fa9f3049f20ee4d573a6c615ebf9e7ecf7abdd1 (patch)
tree29110a4f03ce26db4419817aec2b2e996b22bd27 /lib/private/Contacts
parenta0913739c68d9c4263fc0a9fa7e58f4276458f45 (diff)
downloadnextcloud-server-0fa9f3049f20ee4d573a6c615ebf9e7ecf7abdd1.tar.gz
nextcloud-server-0fa9f3049f20ee4d573a6c615ebf9e7ecf7abdd1.zip
feat(files_sharing): allow to specify allowed groups to share instead of excluded groups
Relates to #3387 Signed-off-by: Corentin Damman <c.damman@intopix.com>
Diffstat (limited to 'lib/private/Contacts')
-rw-r--r--lib/private/Contacts/ContactsMenu/ContactsStore.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php
index 2f141cbc0ab..3b39cc869a7 100644
--- a/lib/private/Contacts/ContactsMenu/ContactsStore.php
+++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php
@@ -193,7 +193,7 @@ class ContactsStore implements IContactsStore {
$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';
+ $excludeGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no');
// whether to filter out local users
$skipLocal = false;
@@ -202,14 +202,22 @@ class ContactsStore implements IContactsStore {
$selfGroups = $this->groupManager->getUserGroupIds($self);
- if ($excludedGroups) {
+ if ($excludeGroups && $excludeGroups !== 'no') {
$excludedGroups = $this->config->getAppValue('core', 'shareapi_exclude_groups_list', '');
$decodedExcludeGroups = json_decode($excludedGroups, true);
$excludeGroupsList = $decodedExcludeGroups ?? [];
- if (count(array_intersect($excludeGroupsList, $selfGroups)) !== 0) {
- // a group of the current user is excluded -> filter all local users
+ if ($excludeGroups != 'allow') {
+ if (count(array_intersect($excludeGroupsList, $selfGroups)) !== 0) {
+ // a group of the current user is excluded -> filter all local users
+ $skipLocal = true;
+ }
+ } else {
$skipLocal = true;
+ if (count(array_intersect($excludeGroupsList, $selfGroups)) !== 0) {
+ // a group of the current user is allowed -> do not filter all local users
+ $skipLocal = false;
+ }
}
}