diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-05-28 17:26:07 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-08-05 14:14:05 +0200 |
commit | fee13e7ffde273b2474684ed7326d79a4c0c6a07 (patch) | |
tree | 27082e07faf3d6922a7c78b9410129512ecc682c /lib/private/Group/Database.php | |
parent | 7b91cb502907f5ebc3323567422dbbe1c9537d62 (diff) | |
download | nextcloud-server-fee13e7ffde273b2474684ed7326d79a4c0c6a07.tar.gz nextcloud-server-fee13e7ffde273b2474684ed7326d79a4c0c6a07.zip |
Search also the email and displayname in user mangement for groups
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/Group/Database.php')
-rw-r--r-- | lib/private/Group/Database.php | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php index 8e6181a56cd..97094c67728 100644 --- a/lib/private/Group/Database.php +++ b/lib/private/Group/Database.php @@ -348,15 +348,27 @@ class Database extends ABackend implements $this->fixDI(); $query = $this->dbConn->getQueryBuilder(); - $query->select('uid') - ->from('group_user') + $query->select('g.uid') + ->from('group_user', 'g') ->where($query->expr()->eq('gid', $query->createNamedParameter($gid))) - ->orderBy('uid', 'ASC'); + ->orderBy('g.uid', 'ASC'); if ($search !== '') { - $query->andWhere($query->expr()->like('uid', $query->createNamedParameter( - '%' . $this->dbConn->escapeLikeParameter($search) . '%' - ))); + $query->leftJoin('g', 'users', 'u', $query->expr()->eq('g.uid', 'u.uid')) + ->leftJoin('u', 'preferences', 'p', $query->expr()->andX( + $query->expr()->eq('p.userid', 'u.uid'), + $query->expr()->eq('p.appid', $query->expr()->literal('settings')), + $query->expr()->eq('p.configkey', $query->expr()->literal('email'))) + ) + // sqlite doesn't like re-using a single named parameter here + ->andWhere( + $query->expr()->orX( + $query->expr()->ilike('g.uid', $query->createNamedParameter('%' . $this->dbConn->escapeLikeParameter($search) . '%')), + $query->expr()->ilike('u.displayname', $query->createNamedParameter('%' . $this->dbConn->escapeLikeParameter($search) . '%')), + $query->expr()->ilike('p.configvalue', $query->createNamedParameter('%' . $this->dbConn->escapeLikeParameter($search) . '%')) + ) + ) + ->orderBy('u.uid_lower', 'ASC'); } if ($limit !== -1) { |