diff options
author | Pytal <24800714+Pytal@users.noreply.github.com> | 2021-06-09 15:33:57 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-09 15:33:57 -0700 |
commit | a416d508deff14f2c1902e9e16bd22bf7e345817 (patch) | |
tree | f51473ee1e6399de1bd8656dacc7707d044d5fa0 /apps/provisioning_api/lib/Controller/GroupsController.php | |
parent | bb2b946c51459a0a16b745fe0d9605d26c7a3875 (diff) | |
parent | e16682aeda94c3c86be131371c35cb4255b86f3a (diff) | |
download | nextcloud-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.php | 11 |
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(); } |