diff --git a/core/Controller/TaskProcessingApiController.php b/core/Controller/TaskProcessingApiController.php index 82b4d78691489..1759b3b017c9d 100644 --- a/core/Controller/TaskProcessingApiController.php +++ b/core/Controller/TaskProcessingApiController.php @@ -13,12 +13,10 @@ use OC\Core\ResponseDefinitions; use OC\Files\SimpleFS\SimpleFile; use OCP\AppFramework\Http; -use OCP\AppFramework\Http\Attribute\AnonRateLimit; use OCP\AppFramework\Http\Attribute\ApiRoute; use OCP\AppFramework\Http\Attribute\ExAppRequired; use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; -use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\Attribute\UserRateLimit; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\StreamResponse; @@ -67,7 +65,7 @@ public function __construct( * * 200: Task types returned */ - #[PublicPage] + #[NoAdminRequired] #[ApiRoute(verb: 'GET', url: '/tasktypes', root: '/taskprocessing')] public function taskTypes(): DataResponse { /** @var array $taskTypes */ @@ -157,9 +155,8 @@ public function taskTypes(): DataResponse { * 412: Scheduling task is not possible * 401: Cannot schedule task because it references files in its input that the user doesn't have access to */ - #[PublicPage] #[UserRateLimit(limit: 20, period: 120)] - #[AnonRateLimit(limit: 5, period: 120)] + #[NoAdminRequired] #[ApiRoute(verb: 'POST', url: '/schedule', root: '/taskprocessing')] public function schedule( array $input, string $type, string $appId, string $customId = '', @@ -200,7 +197,7 @@ public function schedule( * 200: Task returned * 404: Task not found */ - #[PublicPage] + #[NoAdminRequired] #[ApiRoute(verb: 'GET', url: '/task/{id}', root: '/taskprocessing')] public function getTask(int $id): DataResponse { try { diff --git a/core/openapi-full.json b/core/openapi-full.json index 9fb06001e725d..f765254c75c1c 100644 --- a/core/openapi-full.json +++ b/core/openapi-full.json @@ -4761,7 +4761,6 @@ "task_processing_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -4822,6 +4821,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } } @@ -4834,7 +4861,6 @@ "task_processing_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -5061,35 +5087,60 @@ "content": { "application/json": { "schema": { - "type": "object", - "required": [ - "ocs" - ], - "properties": { - "ocs": { + "anyOf": [ + { "type": "object", "required": [ - "meta", - "data" + "ocs" ], "properties": { - "meta": { - "$ref": "#/components/schemas/OCSMeta" - }, - "data": { + "ocs": { "type": "object", "required": [ - "message" + "meta", + "data" ], "properties": { - "message": { - "type": "string" + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "type": "string" + } + } } } } } + }, + { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } } - } + ] } } } @@ -5106,7 +5157,6 @@ "task_processing_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -5250,6 +5300,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } }, diff --git a/core/openapi.json b/core/openapi.json index f9edce6d39259..7d4218074549b 100644 --- a/core/openapi.json +++ b/core/openapi.json @@ -4761,7 +4761,6 @@ "task_processing_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -4822,6 +4821,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } } @@ -4834,7 +4861,6 @@ "task_processing_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -5061,35 +5087,60 @@ "content": { "application/json": { "schema": { - "type": "object", - "required": [ - "ocs" - ], - "properties": { - "ocs": { + "anyOf": [ + { "type": "object", "required": [ - "meta", - "data" + "ocs" ], "properties": { - "meta": { - "$ref": "#/components/schemas/OCSMeta" - }, - "data": { + "ocs": { "type": "object", "required": [ - "message" + "meta", + "data" ], "properties": { - "message": { - "type": "string" + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "type": "string" + } + } } } } } + }, + { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } } - } + ] } } } @@ -5106,7 +5157,6 @@ "task_processing_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -5250,6 +5300,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } }, diff --git a/openapi.json b/openapi.json index a71a1f774d5a8..82415ec4f0d15 100644 --- a/openapi.json +++ b/openapi.json @@ -8273,7 +8273,6 @@ "core/task_processing_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -8334,6 +8333,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } } @@ -8346,7 +8373,6 @@ "core/task_processing_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -8573,35 +8599,60 @@ "content": { "application/json": { "schema": { - "type": "object", - "required": [ - "ocs" - ], - "properties": { - "ocs": { + "anyOf": [ + { "type": "object", "required": [ - "meta", - "data" + "ocs" ], "properties": { - "meta": { - "$ref": "#/components/schemas/OCSMeta" - }, - "data": { + "ocs": { "type": "object", "required": [ - "message" + "meta", + "data" ], "properties": { - "message": { - "type": "string" + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": { + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "type": "string" + } + } } } } } + }, + { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } } - } + ] } } } @@ -8618,7 +8669,6 @@ "core/task_processing_api" ], "security": [ - {}, { "bearer_auth": [] }, @@ -8762,6 +8812,34 @@ } } } + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } } } },