diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2023-04-26 11:34:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-26 11:34:36 +0200 |
commit | 9aed218ee1aead4c79a270fbd284d0dd4246ba91 (patch) | |
tree | c6f37ea6c7ea71328eb0a73e8f4c3124dc8fafab | |
parent | a223f9b56a29fa3030eb63f57700b09b37551cb7 (diff) | |
parent | 092b5aa139416be6a286fab687486124375dfee8 (diff) |
Merge pull request #9377 from nextcloud/techdebt/noid/update-to-server-attributes
feat(controllers): Migrate server annotations to attributes
-rw-r--r-- | composer.lock | 8 | ||||
-rw-r--r-- | lib/Controller/AvatarController.php | 22 | ||||
-rw-r--r-- | lib/Controller/BreakoutRoomController.php | 37 | ||||
-rw-r--r-- | lib/Controller/CallController.php | 20 | ||||
-rw-r--r-- | lib/Controller/ChatController.php | 42 | ||||
-rw-r--r-- | lib/Controller/FederationController.php | 13 | ||||
-rw-r--r-- | lib/Controller/FilesIntegrationController.php | 8 | ||||
-rw-r--r-- | lib/Controller/GuestController.php | 5 | ||||
-rw-r--r-- | lib/Controller/HostedSignalingServerController.php | 5 | ||||
-rw-r--r-- | lib/Controller/MatterbridgeController.php | 13 | ||||
-rw-r--r-- | lib/Controller/PageController.php | 43 | ||||
-rw-r--r-- | lib/Controller/PollController.php | 16 | ||||
-rw-r--r-- | lib/Controller/PublicShareAuthController.php | 4 | ||||
-rw-r--r-- | lib/Controller/ReactionController.php | 13 | ||||
-rw-r--r-- | lib/Controller/RecordingController.php | 25 | ||||
-rw-r--r-- | lib/Controller/RoomController.php | 162 | ||||
-rw-r--r-- | lib/Controller/SettingsController.php | 4 | ||||
-rw-r--r-- | lib/Controller/SignalingController.php | 30 | ||||
-rw-r--r-- | lib/Controller/TempAvatarController.php | 14 |
19 files changed, 146 insertions, 338 deletions
diff --git a/composer.lock b/composer.lock index 8fccf82db..761293546 100644 --- a/composer.lock +++ b/composer.lock @@ -134,12 +134,12 @@ "source": { "type": "git", "url": "https://github.com/nextcloud-deps/ocp.git", - "reference": "91da9a295f2f7db0a0945427efa3632b4386ad99" + "reference": "379b9a0f23d1e035bf59c718c87ab26e9591a3e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/91da9a295f2f7db0a0945427efa3632b4386ad99", - "reference": "91da9a295f2f7db0a0945427efa3632b4386ad99", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/379b9a0f23d1e035bf59c718c87ab26e9591a3e8", + "reference": "379b9a0f23d1e035bf59c718c87ab26e9591a3e8", "shasum": "" }, "require": { @@ -171,7 +171,7 @@ "issues": "https://github.com/nextcloud-deps/ocp/issues", "source": "https://github.com/nextcloud-deps/ocp/tree/master" }, - "time": "2023-04-20T00:33:48+00:00" + "time": "2023-04-26T00:35:30+00:00" }, { "name": "psr/clock", diff --git a/lib/Controller/AvatarController.php b/lib/Controller/AvatarController.php index d908b6b19..7edebf977 100644 --- a/lib/Controller/AvatarController.php +++ b/lib/Controller/AvatarController.php @@ -32,6 +32,8 @@ use OCA\Talk\Middleware\Attribute\RequireParticipant; use OCA\Talk\Service\AvatarService; use OCA\Talk\Service\RoomFormatter; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoCSRFRequired; +use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\FileDisplayResponse; use OCP\AppFramework\Http\Response; @@ -53,9 +55,7 @@ class AvatarController extends AEnvironmentAwareController { parent::__construct($appName, $request); } - /** - * @PublicPage - */ + #[PublicPage] #[RequireModeratorParticipant] public function uploadAvatar(): DataResponse { try { @@ -78,10 +78,8 @@ class AvatarController extends AEnvironmentAwareController { } } - /** - * @PublicPage - * @NoCSRFRequired - */ + #[PublicPage] + #[NoCSRFRequired] #[RequireParticipant] public function getAvatar(bool $darkTheme = false): Response { $file = $this->avatarService->getAvatar($this->getRoom(), $this->userSession->getUser(), $darkTheme); @@ -93,18 +91,14 @@ class AvatarController extends AEnvironmentAwareController { return $response; } - /** - * @PublicPage - * @NoCSRFRequired - */ + #[PublicPage] + #[NoCSRFRequired] #[RequireParticipant] public function getAvatarDark(): Response { return $this->getAvatar(true); } - /** - * @PublicPage - */ + #[PublicPage] #[RequireModeratorParticipant] public function deleteAvatar(): DataResponse { $this->avatarService->deleteAvatar($this->getRoom()); diff --git a/lib/Controller/BreakoutRoomController.php b/lib/Controller/BreakoutRoomController.php index 459993007..f80edc109 100644 --- a/lib/Controller/BreakoutRoomController.php +++ b/lib/Controller/BreakoutRoomController.php @@ -33,6 +33,7 @@ use OCA\Talk\Service\BreakoutRoomService; use OCA\Talk\Service\ParticipantService; use OCA\Talk\Service\RoomFormatter; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\DataResponse; use OCP\Comments\MessageTooLongException; use OCP\IRequest; @@ -49,9 +50,7 @@ class BreakoutRoomController extends AEnvironmentAwareController { parent::__construct($appName, $request); } - /** - * @NoAdminRequired - */ + #[NoAdminRequired] #[RequireLoggedInModeratorParticipant] public function configureBreakoutRooms(int $mode, int $amount, string $attendeeMap = '[]'): DataResponse { try { @@ -64,9 +63,7 @@ class BreakoutRoomController extends AEnvironmentAwareController { return new DataResponse($this->formatMultipleRooms($rooms), Http::STATUS_OK); } - /** - * @NoAdminRequired - */ + #[NoAdminRequired] #[RequireLoggedInModeratorParticipant] public function removeBreakoutRooms(): DataResponse { $this->breakoutRoomService->removeBreakoutRooms($this->room); @@ -79,9 +76,7 @@ class BreakoutRoomController extends AEnvironmentAwareController { )); } - /** - * @NoAdminRequired - */ + #[NoAdminRequired] #[RequireLoggedInModeratorParticipant] public function broadcastChatMessage(string $message): DataResponse { try { @@ -95,9 +90,7 @@ class BreakoutRoomController extends AEnvironmentAwareController { return new DataResponse($this->formatMultipleRooms($rooms), Http::STATUS_CREATED); } - /** - * @NoAdminRequired - */ + #[NoAdminRequired] #[RequireLoggedInModeratorParticipant] public function applyAttendeeMap(string $attendeeMap): DataResponse { try { @@ -109,9 +102,7 @@ class BreakoutRoomController extends AEnvironmentAwareController { return new DataResponse($this->formatMultipleRooms($rooms), Http::STATUS_OK); } - /** - * @NoAdminRequired - */ + #[NoAdminRequired] #[RequireLoggedInParticipant] public function requestAssistance(): DataResponse { try { @@ -128,9 +119,7 @@ class BreakoutRoomController extends AEnvironmentAwareController { )); } - /** - * @NoAdminRequired - */ + #[NoAdminRequired] #[RequireLoggedInParticipant] public function resetRequestForAssistance(): DataResponse { try { @@ -147,9 +136,7 @@ class BreakoutRoomController extends AEnvironmentAwareController { )); } - /** - * @NoAdminRequired - */ + #[NoAdminRequired] #[RequireLoggedInModeratorParticipant] public function startBreakoutRooms(): DataResponse { try { @@ -162,9 +149,7 @@ class BreakoutRoomController extends AEnvironmentAwareController { return new DataResponse($this->formatMultipleRooms($rooms), Http::STATUS_OK); } - /** - * @NoAdminRequired - */ + #[NoAdminRequired] #[RequireLoggedInModeratorParticipant] public function stopBreakoutRooms(): DataResponse { try { @@ -177,9 +162,7 @@ class BreakoutRoomController extends AEnvironmentAwareController { return new DataResponse($this->formatMultipleRooms($rooms), Http::STATUS_OK); } - /** - * @NoAdminRequired - */ + #[NoAdminRequired] #[RequireLoggedInParticipant] public function switchBreakoutRoom(string $target): DataResponse { try { diff --git a/lib/Controller/CallController.php b/lib/Controller/CallController.php index 9df7a6a9d..1c676b78a 100644 --- a/lib/Controller/CallController.php +++ b/lib/Controller/CallController.php @@ -38,6 +38,7 @@ use OCA\Talk\Participant; use OCA\Talk\Service\ParticipantService; use OCA\Talk\Service\RoomService; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Utility\ITimeFactory; use OCP\IRequest; @@ -64,9 +65,7 @@ class CallController extends AEnvironmentAwareController { $this->timeFactory = $timeFactory; } - /** - * @PublicPage - */ + #[PublicPage] #[RequireCallEnabled] #[RequireModeratorOrNoLobby] #[RequireParticipant] @@ -104,9 +103,7 @@ class CallController extends AEnvironmentAwareController { return new DataResponse($result); } - /** - * @PublicPage - */ + #[PublicPage] #[RequireCallEnabled] #[RequireModeratorOrNoLobby] #[RequireParticipant] @@ -133,9 +130,7 @@ class CallController extends AEnvironmentAwareController { return new DataResponse(); } - /** - * @PublicPage - */ + #[PublicPage] #[RequireCallEnabled] #[RequireParticipant] #[RequirePermission(permission: RequirePermission::START_CALL)] @@ -155,9 +150,7 @@ class CallController extends AEnvironmentAwareController { return new DataResponse(); } - /** - * @PublicPage - */ + #[PublicPage] #[RequireParticipant] public function updateCallFlags(int $flags): DataResponse { $session = $this->participant->getSession(); @@ -175,11 +168,10 @@ class CallController extends AEnvironmentAwareController { } /** - * @PublicPage - * * @param bool $all whether to also terminate the call for all participants * @return DataResponse */ + #[PublicPage] #[RequireParticipant] public function leaveCall(bool $all = false): DataResponse { $session = $this->participant->getSession(); diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php index d9ea5131b..06b933196 100644 --- a/lib/Controller/ChatController.php +++ b/lib/Controller/ChatController.php @@ -49,6 +49,8 @@ use OCA\Talk\Service\SessionService; use OCA\Talk\Share\RoomShareProvider; use OCP\App\IAppManager; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; +use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Collaboration\AutoComplete\IManager; @@ -192,8 +194,6 @@ class ChatController extends AEnvironmentAwareController { } /** - * @PublicPage - * * Sends a new chat message to the given room. * * The author and timestamp are automatically set to the current user/guest @@ -208,6 +208,7 @@ class ChatController extends AEnvironmentAwareController { * "404 Not found" if the room or session for a guest user was not * found". */ + #[PublicPage] #[RequireModeratorOrNoLobby] #[RequireParticipant] #[RequirePermission(permission: RequirePermission::CHAT)] @@ -249,8 +250,6 @@ class ChatController extends AEnvironmentAwareController { } /** - * @PublicPage - * * Sends a rich-object to the given room. * * The author and timestamp are automatically set to the current user/guest @@ -265,6 +264,7 @@ class ChatController extends AEnvironmentAwareController { * "404 Not found" if the room or session for a guest user was not * found". */ + #[PublicPage] #[RequireModeratorOrNoLobby] #[RequireParticipant] #[RequirePermission(permission: RequirePermission::CHAT)] @@ -349,8 +349,6 @@ class ChatController extends AEnvironmentAwareController { } /** - * @PublicPage - * * Receives chat messages from the given room. * * - Receiving the history ($lookIntoFuture=0): @@ -398,6 +396,7 @@ class ChatController extends AEnvironmentAwareController { * 'actorDisplayName', 'timestamp' (in seconds and UTC timezone) and * 'message'. */ + #[PublicPage] #[RequireModeratorOrNoLobby] #[RequireParticipant] public function receiveMessages(int $lookIntoFuture, @@ -595,12 +594,11 @@ class ChatController extends AEnvironmentAwareController { } /** - * @PublicPage - * * @param int $messageId The focused message which should be in the "middle" of the returned context * @param int $limit Number of chat messages to receive in both directions (50 by default, 100 at most, might return 201 messages) * @return DataResponse */ + #[PublicPage] #[RequireModeratorOrNoLobby] #[RequireParticipant] public function getMessageContext( @@ -660,9 +658,7 @@ class ChatController extends AEnvironmentAwareController { return $messages; } - /** - * @NoAdminRequired - */ + #[NoAdminRequired] #[RequireModeratorOrNoLobby] #[RequireParticipant] #[RequirePermission(permission: RequirePermission::CHAT)] @@ -730,9 +726,7 @@ class ChatController extends AEnvironmentAwareController { return $response; } - /** - * @NoAdminRequired - */ + #[NoAdminRequired] #[RequireModeratorParticipant] #[RequireReadWriteConversation] public function clearHistory(): DataResponse { @@ -765,9 +759,7 @@ class ChatController extends AEnvironmentAwareController { return $response; } - /** - * @NoAdminRequired - */ + #[NoAdminRequired] #[RequireParticipant] public function setReadMarker(int $lastReadMessage): DataResponse { $this->participantService->updateLastReadMessage($this->participant, $lastReadMessage); @@ -778,9 +770,7 @@ class ChatController extends AEnvironmentAwareController { return $response; } - /** - * @NoAdminRequired - */ + #[NoAdminRequired] #[RequireParticipant] public function markUnread(): DataResponse { $message = $this->room->getLastMessage(); @@ -804,9 +794,7 @@ class ChatController extends AEnvironmentAwareController { return $this->setReadMarker($unreadId); } - /** - * @PublicPage - */ + #[PublicPage] #[RequireModeratorOrNoLobby] #[RequireParticipant] public function getObjectsSharedInRoomOverview(int $limit = 7): DataResponse { @@ -849,9 +837,7 @@ class ChatController extends AEnvironmentAwareController { return new DataResponse($messagesByType, Http::STATUS_OK); } - /** - * @PublicPage - */ + #[PublicPage] #[RequireModeratorOrNoLobby] #[RequireParticipant] public function getObjectsSharedInRoom(string $objectType, int $lastKnownMessageId = 0, int $limit = 100): DataResponse { @@ -900,9 +886,7 @@ class ChatController extends AEnvironmentAwareController { return $messages; } - /** - * @PublicPage - */ + #[PublicPage] #[RequireModeratorOrNoLobby] #[RequireParticipant] #[RequirePermission(permission: RequirePermission::CHAT)] diff --git a/lib/Controller/FederationController.php b/lib/Controller/FederationController.php index 1f6e848bd..46307648b 100644 --- a/lib/Controller/FederationController.php +++ b/lib/Controller/FederationController.php @@ -32,6 +32,7 @@ use OCA\Talk\Federation\FederationManager; use OCA\Talk\Manager; use OCA\Talk\Model\Invitation; use OCP\AppFramework\Db\MultipleObjectsReturnedException; +use OCP\AppFramework\Http\Attribute\NoAdminRequired; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCSController; use OCP\DB\Exception as DBException; @@ -59,14 +60,13 @@ class FederationController extends OCSController { } /** - * @NoAdminRequired - * * @param int $id * @return DataResponse * @throws UnauthorizedException * @throws DBException * @throws MultipleObjectsReturnedException */ + #[NoAdminRequired] public function acceptShare(int $id): DataResponse { $user = $this->userSession->getUser(); if (!$user instanceof IUser) { @@ -77,14 +77,13 @@ class FederationController extends OCSController { } /** - * @NoAdminRequired - * * @param int $id * @return DataResponse * @throws UnauthorizedException * @throws DBException * @throws MultipleObjectsReturnedException |