Skip to content

Commit

Permalink
Limit and offset
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
  • Loading branch information
skjnldsv committed Mar 23, 2018
1 parent d473653 commit 2a8356d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/provisioning_api/lib/Controller/GroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,12 @@ public function getGroupUsers(string $groupId): DataResponse {
* @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
Expand All @@ -208,6 +210,8 @@ public function getGroupUsersDetails(string $groupId): DataResponse {
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());
Expand Down

0 comments on commit 2a8356d

Please sign in to comment.