diff options
author | Louis Chemineau <louis@chmn.me> | 2022-05-10 14:05:08 +0300 |
---|---|---|
committer | Louis Chemineau <louis@chmn.me> | 2022-07-07 13:42:29 +0300 |
commit | 752a9fa8d6454513e3e89636eebe201d13b17de0 (patch) | |
tree | da36dae2081ce6c345a3d9679234fc35c292e498 /lib/private | |
parent | 1d6ecf43afc4e11a23776dd26817fc794c79c4b8 (diff) |
Add settings to ignore second display name in search
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Collaboration/Collaborators/UserPlugin.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php index 510f383249a..819ecfa50d8 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) { |