Skip to content

Commit

Permalink
Fix issue when disabling the shareapi_only_share_with_group_members o…
Browse files Browse the repository at this point in the history
…ption + fix findOne

Signed-off-by: Tobia De Koninck <[email protected]>
  • Loading branch information
LEDfan committed Aug 14, 2017
1 parent dfa7f94 commit 3253e11
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/private/Contacts/ContactsMenu/ContactsStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private function filterContacts(IUser $self, array $entries) {
// 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);

Expand Down Expand Up @@ -172,7 +172,17 @@ public function findOne(IUser $user, $shareType, $shareWith) {
}
}

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;
}

/**
Expand Down

0 comments on commit 3253e11

Please sign in to comment.