summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-09-20 11:33:02 +0200
committerJoas Schilling <coding@schilljs.com>2019-09-27 14:29:56 +0200
commit653628c8fb69dc3f9d26751520f91e43a18f17ae (patch)
treeef2dfb5f01bc19e09386364895ec9c8620ec3257 /apps/provisioning_api
parent45506adc5c2a34a8c812a2a3c9273a8447b450af (diff)
downloadnextcloud-server-653628c8fb69dc3f9d26751520f91e43a18f17ae.tar.gz
nextcloud-server-653628c8fb69dc3f9d26751520f91e43a18f17ae.zip
Allow to set the group display name in the database backend
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/provisioning_api')
-rw-r--r--apps/provisioning_api/appinfo/routes.php1
-rw-r--r--apps/provisioning_api/lib/Controller/GroupsController.php24
2 files changed, 24 insertions, 1 deletions
diff --git a/apps/provisioning_api/appinfo/routes.php b/apps/provisioning_api/appinfo/routes.php
index fb0a6b235ce..ef13159af5b 100644
--- a/apps/provisioning_api/appinfo/routes.php
+++ b/apps/provisioning_api/appinfo/routes.php
@@ -40,6 +40,7 @@ return [
['root' => '/cloud', 'name' => 'Groups#getSubAdminsOfGroup', 'url' => '/groups/{groupId}/subadmins', 'verb' => 'GET', 'requirements' => ['groupId' => '.+']],
['root' => '/cloud', 'name' => 'Groups#addGroup', 'url' => '/groups', 'verb' => 'POST'],
['root' => '/cloud', 'name' => 'Groups#getGroup', 'url' => '/groups/{groupId}', 'verb' => 'GET', 'requirements' => ['groupId' => '.+']],
+ ['root' => '/cloud', 'name' => 'Groups#updateGroup', 'url' => '/groups/{groupId}', 'verb' => 'PUT', 'requirements' => ['groupId' => '.+']],
['root' => '/cloud', 'name' => 'Groups#deleteGroup', 'url' => '/groups/{groupId}', 'verb' => 'DELETE', 'requirements' => ['groupId' => '.+']],
// Users
diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php
index 7c4447ac4eb..72285f55192 100644
--- a/apps/provisioning_api/lib/Controller/GroupsController.php
+++ b/apps/provisioning_api/lib/Controller/GroupsController.php
@@ -129,7 +129,7 @@ class GroupsController extends AUserData {
*
* @param string $groupId
* @return DataResponse
- * @throws OCSException
+ * @throws OCSException
*
* @deprecated 14 Use getGroupUsers
*/
@@ -252,6 +252,28 @@ class GroupsController extends AUserData {
* @PasswordConfirmationRequired
*
* @param string $groupId
+ * @param string $key
+ * @param string $value
+ * @return DataResponse
+ * @throws OCSException
+ */
+ public function updateGroup(string $groupId, string $key, string $value): DataResponse {
+ if ($key === 'displayname') {
+ $group = $this->groupManager->get($groupId);
+ if ($group->setDisplayName($value)) {
+ return new DataResponse();
+ }
+
+ throw new OCSException('Not supported by backend', 101);
+ } else {
+ throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
+ }
+ }
+
+ /**
+ * @PasswordConfirmationRequired
+ *
+ * @param string $groupId
* @return DataResponse
* @throws OCSException
*/