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>
tags/v18.0.0beta1
Roeland Jago Douma 4 years ago
parent
commit
6db51324fa
No account linked to committer's email address
1 changed files with 8 additions and 3 deletions
  1. 8
    3
      lib/private/Group/Database.php

+ 8
- 3
lib/private/Group/Database.php View File

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