summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2022-04-12 12:54:39 +0200
committerLouis Chemineau <louis@chmn.me>2022-04-12 17:27:59 +0200
commit37f1c8640eef8230489df2cae886ff8cb236e9b7 (patch)
tree39e9e8f31181505a6a11a0ea86a57cd4863ac490 /lib
parentff0ccc80b4d6b6d011cf0ef0468ea319d6e8841f (diff)
downloadnextcloud-server-37f1c8640eef8230489df2cae886ff8cb236e9b7.tar.gz
nextcloud-server-37f1c8640eef8230489df2cae886ff8cb236e9b7.zip
Add settings to ignore second display name in search
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Collaboration/Collaborators/UserPlugin.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php
index 4d8bc4cbf3a..af4d8b2ccca 100644
--- a/lib/private/Collaboration/Collaborators/UserPlugin.php
+++ b/lib/private/Collaboration/Collaborators/UserPlugin.php
@@ -56,6 +56,8 @@ class UserPlugin implements ISearchPlugin {
protected $shareeEnumerationFullMatch;
/* @var bool */
protected $shareeEnumerationFullMatchUserId;
+ /* @var bool */
+ protected $shareeEnumerationFullMatchIgnoreSecondDisplayName;
/** @var IConfig */
private $config;
@@ -90,6 +92,7 @@ class UserPlugin implements ISearchPlugin {
$this->shareeEnumerationPhone = $this->shareeEnumeration && $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_phone', 'no') === 'yes';
$this->shareeEnumerationFullMatch = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match', 'yes') === 'yes';
$this->shareeEnumerationFullMatchUserId = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_userid', 'yes') === 'yes';
+ $this->shareeEnumerationFullMatchIgnoreSecondDisplayName = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_display_name', 'no') === 'yes';
}
public function search($search, $limit, $offset, ISearchResult $searchResult) {
@@ -181,6 +184,7 @@ class UserPlugin implements ISearchPlugin {
$this->shareeEnumerationFullMatch &&
$lowerSearch !== '' && (strtolower($uid) === $lowerSearch ||
strtolower($userDisplayName) === $lowerSearch ||
+ ($this->shareeEnumerationFullMatchIgnoreSecondDisplayName && trim(strtolower(preg_replace('/ \(.*\)$/', '', $userDisplayName))) === $lowerSearch) ||
strtolower($userEmail ?? '') === $lowerSearch)
) {
if (strtolower($uid) === $lowerSearch) {