Browse Source

Fix DB usersInGroups fetching

* Follow the interface defaults
* Only set limit or offset if they are properly set

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
pull/17366/head
Roeland Jago Douma 6 years ago
parent
commit
6db51324fa
No known key found for this signature in database GPG Key ID: F941078878347C0C
  1. 11
      lib/private/Group/Database.php

11
lib/private/Group/Database.php

@ -322,7 +322,7 @@ class Database extends ABackend
* @param int $offset
* @return array an array of user ids
*/
public function usersInGroup($gid, $search = '', $limit = null, $offset = null) {
public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
$this->fixDI();
$query = $this->dbConn->getQueryBuilder();
@ -337,8 +337,13 @@ class Database extends ABackend
)));
}
$query->setMaxResults($limit)
->setFirstResult($offset);
if ($limit !== -1) {
$query->setMaxResults($limit);
}
if ($offset !== 0) {
$query->setFirstResult($offset);
}
$result = $query->execute();
$users = [];

Loading…
Cancel
Save