From 5896176d69d00843cbe4b2acfb45beaa1de76530 Mon Sep 17 00:00:00 2001 From: Tobia De Koninck Date: Mon, 14 Aug 2017 11:45:54 +0200 Subject: [PATCH] Fix issue when disabling the shareapi_only_share_with_group_members option + fix findOne Signed-off-by: Tobia De Koninck --- .../Contacts/ContactsMenu/ContactsStore.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php index 299e88ad01..87aff258aa 100644 --- a/lib/private/Contacts/ContactsMenu/ContactsStore.php +++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php @@ -94,7 +94,7 @@ class ContactsStore { // whether to filter out local users $skipLocal = false; // whether to filter out all users which doesn't have the same group as the current user - $ownGroupsOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no'); + $ownGroupsOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes'; $selfGroups = $this->groupManager->getUserGroupIds($self); @@ -172,7 +172,17 @@ class ContactsStore { } } - return $match ? $this->contactArrayToEntry($match) : null; + if ($match) { + $match = $this->filterContacts($user, [$this->contactArrayToEntry($match)]); + if (count($match) === 1) { + $match = $match[0]; + } else { + $match = null; + } + + } + + return $match; } /**