Principal search by display name case insensitive

Adjust principal search to be case insensitive even with exact match.
This aligns the behavior to how the search also works in
Collaborators/UserPlugin

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
Vincent Petry 2022-04-08 10:20:24 +02:00 committed by backportbot[bot]
parent e2f137c2db
commit 0aa70b3d88

View file

@ -347,9 +347,10 @@ class Principal implements BackendInterface {
if (!$allowEnumeration) {
if ($allowEnumerationFullMatch) {
$lowerSearch = strtolower($value);
$users = $this->userManager->searchDisplayName($value, $searchLimit);
$users = \array_filter($users, static function (IUser $user) use ($value) {
return $user->getDisplayName() === $value;
$users = \array_filter($users, static function (IUser $user) use ($lowerSearch) {
return strtolower($user->getDisplayName()) === $lowerSearch;
});
} else {
$users = [];