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>
pull/31886/head
Vincent Petry 3 years ago
parent 69378e1534
commit 1bac5e2cbe
No known key found for this signature in database
GPG Key ID: E055D6A4D513575C
  1. 5
      apps/dav/lib/Connector/Sabre/Principal.php

@ -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 = [];

Loading…
Cancel
Save