Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/Controller/WorkspaceApiOcsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\OCS\OCSBadRequestException;
use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCS\OCSForbiddenException;
use OCP\AppFramework\OCS\OCSNotFoundException;
use OCP\AppFramework\OCSController;
use OCP\IGroupManager;
Expand Down Expand Up @@ -567,10 +568,11 @@ public function removeUsersFromGroup(int $id, string $gid, array $uids): DataRes
* @param int $id Represents the ID of the workspace
* @param string $gid The subgroup id
* @param list<string> $uids Represents the user uids to add to the subgroup
* @return DataResponse<Http::STATUS_OK, WorkspaceSpace, array{}>|DataResponse<Http::STATUS_NOT_FOUND, null, array{}>
* @return DataResponse<Http::STATUS_OK, WorkspaceSpace, array{}>|DataResponse<Http::STATUS_NOT_FOUND, null, array{}>|DataResponse<Http::STATUS_FORBIDDEN, null, array{}>
* @throws OCSException for all unknown errors
*
* 200: Users added in subgroup successfully
* 403: Target group does not belong to the workspace
* 404: Subgroup with this id does not exist
*/
#[OpenAPI(tags: ['workspace-users'])]
Expand All @@ -597,7 +599,7 @@ public function addUsersToGroup(int $id, string $gid, array $uids): Response {
$spacename = $workspace['name'];

if (!in_array($gid, $gids)) {
throw new OCSException("Group {$gid} does not belongs to the {$spacename} workspace.");
throw new OCSForbiddenException("Group {$gid} does not belongs to the {$spacename} workspace.");
}
$group = $this->groupManager->get($gid);
if ($group === null) {
Expand Down
40 changes: 36 additions & 4 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
"/ocs/v2.php/apps/workspace/api/v1/spaces": {
"get": {
"operationId": "workspace_api_ocs-find-all",
"summary": "Return the first 30 workspaces (optional filtering by name)",
"summary": "Return the first 25 workspaces (optional filtering by name)",
"tags": [
"workspace"
],
Expand All @@ -257,13 +257,14 @@
}
},
{
"name": "page",
"name": "offset",
"in": "query",
"description": "Optional page number for pagination",
"schema": {
"type": "integer",
"format": "int64",
"nullable": true
"nullable": true,
"default": null
}
},
{
Expand All @@ -273,7 +274,8 @@
"schema": {
"type": "integer",
"format": "int64",
"nullable": true
"nullable": true,
"default": null
}
},
{
Expand Down Expand Up @@ -2011,6 +2013,36 @@
}
}
},
"403": {
"description": "Target group does not belong to the workspace",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"nullable": true
}
}
}
}
}
}
}
},
"401": {
"description": "Current user is not logged in",
"content": {
Expand Down
Loading