Limit and offset

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2018-03-23 18:08:54 +01:00
parent 68ae4394f7
commit f4e84e1727
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
1 changed files with 5 additions and 1 deletions

View File

@ -187,10 +187,12 @@ class GroupsController extends OCSController {
* @NoAdminRequired
*
* @param string $groupId
* @param int $limit
* @param int $offset
* @return DataResponse
* @throws OCSException
*/
public function getGroupUsersDetails(string $groupId): DataResponse {
public function getGroupUsersDetails(string $groupId, $limit = null, $offset = 0): DataResponse {
$user = $this->userSession->getUser();
// Check the group exists
@ -208,6 +210,8 @@ class GroupsController extends OCSController {
if($this->groupManager->isAdmin($user->getUID())
|| $isSubadminOfGroup) {
$users = $this->groupManager->get($groupId)->getUsers();
// Extract required number
$users = array_slice($users, $offset, $limit);
$users = array_map(function($user) {
/** @var IUser $user */
return $this->userController->getUserData($user->getUID());