From 5f38cfbc8072936c71d3e15d98a6df75079d046c Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Sat, 17 Mar 2018 14:47:47 +0100 Subject: Return groups displayname in provisioning api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- .../lib/Controller/GroupsController.php | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'apps/provisioning_api/lib/Controller') 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 @@ -96,6 +96,33 @@ class GroupsController extends OCSController { return new DataResponse(['groups' => $groups]); } + /** + * 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 * -- cgit v1.2.3