Fix search in user managent when no group is selected

* also allows to search by displayname

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Morris Jobke 2017-11-14 17:32:03 +01:00
parent 6d1d2dde0b
commit eb0f3ebf75
No known key found for this signature in database
GPG Key ID: FE03C3A163FEDE68
2 changed files with 3 additions and 1 deletions

View File

@ -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);

View File

@ -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);