summaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api/lib/Controller/GroupsController.php
diff options
context:
space:
mode:
authorPytal <24800714+Pytal@users.noreply.github.com>2021-06-09 15:33:57 -0700
committerGitHub <noreply@github.com>2021-06-09 15:33:57 -0700
commita416d508deff14f2c1902e9e16bd22bf7e345817 (patch)
treef51473ee1e6399de1bd8656dacc7707d044d5fa0 /apps/provisioning_api/lib/Controller/GroupsController.php
parentbb2b946c51459a0a16b745fe0d9605d26c7a3875 (diff)
parente16682aeda94c3c86be131371c35cb4255b86f3a (diff)
downloadnextcloud-server-a416d508deff14f2c1902e9e16bd22bf7e345817.tar.gz
nextcloud-server-a416d508deff14f2c1902e9e16bd22bf7e345817.zip
Merge pull request #27089 from m7913d/feature/addGroupDisplayNames
[ProvisioningAPI] Allow specifying group display name during creation
Diffstat (limited to 'apps/provisioning_api/lib/Controller/GroupsController.php')
-rw-r--r--apps/provisioning_api/lib/Controller/GroupsController.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php
index 543fc3b40ac..7b6e5319c2a 100644
--- a/apps/provisioning_api/lib/Controller/GroupsController.php
+++ b/apps/provisioning_api/lib/Controller/GroupsController.php
@@ -232,10 +232,11 @@ class GroupsController extends AUserData {
* @PasswordConfirmationRequired
*
* @param string $groupid
+ * @param string $displayname
* @return DataResponse
* @throws OCSException
*/
- public function addGroup(string $groupid): DataResponse {
+ public function addGroup(string $groupid, string $displayname = ''): DataResponse {
// Validate name
if (empty($groupid)) {
$this->logger->error('Group name not supplied', ['app' => 'provisioning_api']);
@@ -245,7 +246,13 @@ class GroupsController extends AUserData {
if ($this->groupManager->groupExists($groupid)) {
throw new OCSException('group exists', 102);
}
- $this->groupManager->createGroup($groupid);
+ $group = $this->groupManager->createGroup($groupid);
+ if ($group === null) {
+ throw new OCSException('Not supported by backend', 103);
+ }
+ if ($displayname !== '') {
+ $group->setDisplayName($displayname);
+ }
return new DataResponse();
}