diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2018-03-23 14:44:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-23 14:44:13 +0100 |
commit | 3d8fcad88b610a41c4939663ab3b4256a149ab1f (patch) | |
tree | 512fbc2e7cb778838014ab7d55e89813b85bf3d8 /apps/provisioning_api/lib | |
parent | 34cb8ea161e9e5253dd43814140cff236860ab43 (diff) | |
parent | 5f38cfbc8072936c71d3e15d98a6df75079d046c (diff) | |
download | nextcloud-server-3d8fcad88b610a41c4939663ab3b4256a149ab1f.tar.gz nextcloud-server-3d8fcad88b610a41c4939663ab3b4256a149ab1f.zip |
Merge pull request #8865 from nextcloud/ocs-groups-displayname
Return groups displayname in provisioning api
Diffstat (limited to 'apps/provisioning_api/lib')
-rw-r--r-- | apps/provisioning_api/lib/Controller/GroupsController.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php index 8aed50bf049..d6f2d9f3391 100644 --- a/apps/provisioning_api/lib/Controller/GroupsController.php +++ b/apps/provisioning_api/lib/Controller/GroupsController.php @@ -97,6 +97,33 @@ class GroupsController extends OCSController { } /** + * returns a list of groups details with ids and displaynames + * + * @NoAdminRequired + * + * @param string $search + * @param int $limit + * @param int $offset + * @return DataResponse + */ + public function getGroupsDetails(string $search = '', $limit = null, $offset = null): DataResponse { + if ($limit !== null) { + $limit = (int)$limit; + } + if ($offset !== null) { + $offset = (int)$offset; + } + + $groups = $this->groupManager->search($search, $limit, $offset); + $groups = array_map(function($group) { + /** @var IGroup $group */ + return ['id' => $group->getGID(), 'displayname' => $group->getDisplayName()]; + }, $groups); + + return new DataResponse(['groups' => $groups]); + } + + /** * returns an array of users in the group specified * * @NoAdminRequired |