mirror of
https://github.com/nextcloud/server.git
synced 2026-05-25 02:34:12 -04:00
Use share setting in DAV search
shareapi_restrict_user_enumeration_full_match_ignore_second_display_name was introduced to ignore second display name during search from the share panel. But this setting was not respected by search from the calendar application. This fix it. Signed-off-by: Louis Chemineau <louis@chmn.me>
This commit is contained in:
parent
3ecb7da97b
commit
831937e341
1 changed files with 4 additions and 2 deletions
|
|
@ -265,6 +265,7 @@ class Principal implements BackendInterface {
|
|||
$limitEnumerationGroup = $this->shareManager->limitEnumerationToGroups();
|
||||
$limitEnumerationPhone = $this->shareManager->limitEnumerationToPhone();
|
||||
$allowEnumerationFullMatch = $this->shareManager->allowEnumerationFullMatch();
|
||||
$ignoreSecondDisplayName = $this->shareManager->ignoreSecondDisplayName();
|
||||
|
||||
// If sharing is restricted to group members only,
|
||||
// return only members that have groups in common
|
||||
|
|
@ -344,8 +345,9 @@ class Principal implements BackendInterface {
|
|||
if ($allowEnumerationFullMatch) {
|
||||
$lowerSearch = strtolower($value);
|
||||
$users = $this->userManager->searchDisplayName($value, $searchLimit);
|
||||
$users = \array_filter($users, static function (IUser $user) use ($lowerSearch) {
|
||||
return strtolower($user->getDisplayName()) === $lowerSearch;
|
||||
$users = \array_filter($users, static function (IUser $user) use ($lowerSearch, $ignoreSecondDisplayName) {
|
||||
$lowerDisplayName = strtolower($user->getDisplayName());
|
||||
return $lowerDisplayName === $lowerSearch || ($ignoreSecondDisplayName && trim(preg_replace('/ \(.*\)$/', '', $lowerDisplayName)) === $lowerSearch);
|
||||
});
|
||||
} else {
|
||||
$users = [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue