summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-03-17 14:47:47 +0100
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-03-23 12:06:50 +0100
commit5f38cfbc8072936c71d3e15d98a6df75079d046c (patch)
treee5a2b71a1390ff2343571590e641fbeeb25b227c /apps/provisioning_api/lib
parent3cac7911d592260fd48a489ee07bf4cb3b500dd9 (diff)
downloadnextcloud-server-5f38cfbc8072936c71d3e15d98a6df75079d046c.tar.gz
nextcloud-server-5f38cfbc8072936c71d3e15d98a6df75079d046c.zip
Return groups displayname in provisioning api
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/provisioning_api/lib')
-rw-r--r--apps/provisioning_api/lib/Controller/GroupsController.php27
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