Skip to content

Commit 1ada666

Browse files
author
Vincent Petry
authored
Merge pull request #28818 from owncloud/sharee-search-exact-term
Add exact search term hits to sharee response
2 parents 64f521a + c987e01 commit 1ada666

File tree

2 files changed

+1686
-1634
lines changed

2 files changed

+1686
-1634
lines changed

apps/files_sharing/lib/Controller/ShareesController.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,15 @@ protected function getUsers($search) {
166166
$lowerSearch = strtolower($search);
167167
foreach ($users as $uid => $user) {
168168
/* @var $user IUser */
169-
if (strtolower($uid) === $lowerSearch || strtolower($user->getDisplayName()) === $lowerSearch || strtolower($user->getEMailAddress()) === $lowerSearch) {
169+
if (
170+
// Check if the uid is the same
171+
strtolower($uid) === $lowerSearch
172+
// Check if exact display name
173+
|| strtolower($user->getDisplayName()) === $lowerSearch
174+
// Check if exact first email
175+
|| strtolower($user->getEMailAddress()) === $lowerSearch
176+
// Check for exact search term matches (when mail attributes configured as search terms + no enumeration)
177+
|| in_array($lowerSearch, array_map('strtolower', $user->getSearchTerms()))) {
170178
if (strtolower($uid) === $lowerSearch) {
171179
$foundUserById = true;
172180
}

0 commit comments

Comments
 (0)