diff options
Diffstat (limited to 'core/Controller/CollaborationResourcesController.php')
-rw-r--r-- | core/Controller/CollaborationResourcesController.php | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/core/Controller/CollaborationResourcesController.php b/core/Controller/CollaborationResourcesController.php index 5422358b6cf..e160d733176 100644 --- a/core/Controller/CollaborationResourcesController.php +++ b/core/Controller/CollaborationResourcesController.php @@ -10,9 +10,10 @@ declare(strict_types=1); namespace OC\Core\Controller; use Exception; -use OCA\Core\ResponseDefinitions; +use OC\Core\ResponseDefinitions; use OCP\AppFramework\Http; use OCP\AppFramework\Http\Attribute\ApiRoute; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCSController; use OCP\Collaboration\Resources\CollectionException; @@ -55,16 +56,15 @@ class CollaborationResourcesController extends OCSController { } /** - * @NoAdminRequired - * * Get a collection * * @param int $collectionId ID of the collection - * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}> * * 200: Collection returned * 404: Collection not found */ + #[NoAdminRequired] #[ApiRoute(verb: 'GET', url: '/resources/collections/{collectionId}', root: '/collaboration')] public function listCollection(int $collectionId): DataResponse { try { @@ -77,16 +77,15 @@ class CollaborationResourcesController extends OCSController { } /** - * @NoAdminRequired - * * Search for collections * * @param string $filter Filter collections - * @return DataResponse<Http::STATUS_OK, CoreCollection[], array{}>|DataResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, list<CoreCollection>, array{}>|DataResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}> * * 200: Collections returned * 404: Collection not found */ + #[NoAdminRequired] #[ApiRoute(verb: 'GET', url: '/resources/collections/search/{filter}', root: '/collaboration')] public function searchCollections(string $filter): DataResponse { try { @@ -99,18 +98,17 @@ class CollaborationResourcesController extends OCSController { } /** - * @NoAdminRequired - * * Add a resource to a collection * * @param int $collectionId ID of the collection * @param string $resourceType Name of the resource * @param string $resourceId ID of the resource - * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}> * * 200: Collection returned * 404: Collection not found or resource inaccessible */ + #[NoAdminRequired] #[ApiRoute(verb: 'POST', url: '/resources/collections/{collectionId}', root: '/collaboration')] public function addResource(int $collectionId, string $resourceType, string $resourceId): DataResponse { try { @@ -134,18 +132,17 @@ class CollaborationResourcesController extends OCSController { } /** - * @NoAdminRequired - * * Remove a resource from a collection * * @param int $collectionId ID of the collection * @param string $resourceType Name of the resource * @param string $resourceId ID of the resource - * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}> * * 200: Collection returned * 404: Collection or resource not found */ + #[NoAdminRequired] #[ApiRoute(verb: 'DELETE', url: '/resources/collections/{collectionId}', root: '/collaboration')] public function removeResource(int $collectionId, string $resourceType, string $resourceId): DataResponse { try { @@ -166,17 +163,16 @@ class CollaborationResourcesController extends OCSController { } /** - * @NoAdminRequired - * * Get collections by resource * * @param string $resourceType Type of the resource * @param string $resourceId ID of the resource - * @return DataResponse<Http::STATUS_OK, CoreCollection[], array{}>|DataResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, list<CoreCollection>, array{}>|DataResponse<Http::STATUS_NOT_FOUND, list<empty>, array{}> * * 200: Collections returned * 404: Resource not accessible */ + #[NoAdminRequired] #[ApiRoute(verb: 'GET', url: '/resources/{resourceType}/{resourceId}', root: '/collaboration')] public function getCollectionsByResource(string $resourceType, string $resourceId): DataResponse { try { @@ -193,19 +189,18 @@ class CollaborationResourcesController extends OCSController { } /** - * @NoAdminRequired - * * Create a collection for a resource * * @param string $baseResourceType Type of the base resource * @param string $baseResourceId ID of the base resource * @param string $name Name of the collection - * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}> * * 200: Collection returned * 400: Creating collection is not possible * 404: Resource inaccessible */ + #[NoAdminRequired] #[ApiRoute(verb: 'POST', url: '/resources/{baseResourceType}/{baseResourceId}', root: '/collaboration')] public function createCollectionOnResource(string $baseResourceType, string $baseResourceId, string $name): DataResponse { if (!isset($name[0]) || isset($name[64])) { @@ -229,17 +224,16 @@ class CollaborationResourcesController extends OCSController { } /** - * @NoAdminRequired - * * Rename a collection * * @param int $collectionId ID of the collection * @param string $collectionName New name - * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}> * * 200: Collection returned * 404: Collection not found */ + #[NoAdminRequired] #[ApiRoute(verb: 'PUT', url: '/resources/collections/{collectionId}', root: '/collaboration')] public function renameCollection(int $collectionId, string $collectionName): DataResponse { try { @@ -254,7 +248,7 @@ class CollaborationResourcesController extends OCSController { } /** - * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, array<empty>, array{}> + * @return DataResponse<Http::STATUS_OK, CoreCollection, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_INTERNAL_SERVER_ERROR, list<empty>, array{}> */ protected function respondCollection(ICollection $collection): DataResponse { try { @@ -268,7 +262,7 @@ class CollaborationResourcesController extends OCSController { } /** - * @return CoreCollection[] + * @return list<CoreCollection> */ protected function prepareCollections(array $collections): array { $result = []; @@ -301,7 +295,7 @@ class CollaborationResourcesController extends OCSController { } /** - * @return CoreResource[] + * @return list<CoreResource> */ protected function prepareResources(array $resources): array { $result = []; |