From eb0f3ebf752f07f5dd721b8927514588b8428fc3 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 14 Nov 2017 17:32:03 +0100 Subject: [PATCH] Fix search in user managent when no group is selected * also allows to search by displayname Signed-off-by: Morris Jobke --- lib/private/User/Database.php | 2 ++ settings/Controller/UsersController.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php index a835ca3384..471ff1f45a 100644 --- a/lib/private/User/Database.php +++ b/lib/private/User/Database.php @@ -290,6 +290,8 @@ class Database extends Backend implements IUserBackend { if ($search !== '') { $parameters[] = '%' . \OC::$server->getDatabaseConnection()->escapeLikeParameter($search) . '%'; $searchLike = ' WHERE LOWER(`uid`) LIKE LOWER(?)'; + $parameters[] = '%' . \OC::$server->getDatabaseConnection()->escapeLikeParameter($search) . '%'; + $searchLike .= ' OR LOWER(`displayname`) LIKE LOWER(?)'; } $query = \OC_DB::prepare('SELECT `uid` FROM `*PREFIX*users`' . $searchLike . ' ORDER BY LOWER(`uid`) ASC', $limit, $offset); diff --git a/settings/Controller/UsersController.php b/settings/Controller/UsersController.php index d583dc8690..68c920dde1 100644 --- a/settings/Controller/UsersController.php +++ b/settings/Controller/UsersController.php @@ -308,7 +308,7 @@ class UsersController extends Controller { $userObjects = []; $users = []; if ($this->isAdmin) { - if ($gid !== '' && $gid !== '_disabledUsers') { + if ($gid !== '' && $gid !== '_disabledUsers' && $gid !== '_everyone') { $batch = $this->getUsersForUID($this->groupManager->displayNamesInGroup($gid, $pattern, $limit, $offset)); } else { $batch = $this->userManager->search($pattern, $limit, $offset);