diff options
author | Joas Schilling <coding@schilljs.com> | 2023-04-24 12:42:04 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-04-24 12:42:04 +0200 |
commit | 5625c65c9ea3b053f1d943046a1f75e401526af2 (patch) | |
tree | e5b948f6a0596ac23837a7f9670696cdb8fe415d | |
parent | 26f74213b2a04d4c52c4a8e5b1a86c2952a36fb1 (diff) |
fix(controllers): Migrate to UseSession attribute
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/Controller/FilesIntegrationController.php | 5 | ||||
-rw-r--r-- | lib/Controller/PageController.php | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/Controller/FilesIntegrationController.php b/lib/Controller/FilesIntegrationController.php index 4606eaf5a..be50a1165 100644 --- a/lib/Controller/FilesIntegrationController.php +++ b/lib/Controller/FilesIntegrationController.php @@ -31,6 +31,7 @@ use OCA\Talk\Room; use OCA\Talk\Service\RoomService; use OCA\Talk\TalkSession; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\UseSession; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSException; use OCP\AppFramework\OCS\OCSNotFoundException; @@ -148,7 +149,6 @@ class FilesIntegrationController extends OCSController { /** * @PublicPage - * @UseSession * @BruteForceProtection(action=shareinfo) * * Returns the token of the room associated to the file id of the given @@ -173,12 +173,13 @@ class FilesIntegrationController extends OCSController { * Besides the token of the room this also returns the current user ID and * display name, if any; this is needed by the Talk sidebar to know the * actual current user, as the public share page uses the incognito mode and - * thus logged in users as seen as guests. + * thus logged-in users as seen as guests. * * @param string $shareToken * @return DataResponse the status code is "200 OK" if a room is returned, * or "404 Not found" if the given share token was invalid. */ + #[UseSession] public function getRoomByShareToken(string $shareToken): DataResponse { if ($this->config->getAppValue('spreed', 'conversations_files', '1') !== '1' || $this->config->getAppValue('spreed', 'conversations_files_public_shares', '1') !== '1') { diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 88ddddf61..c4a3f0d50 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -40,6 +40,7 @@ use OCA\Viewer\Event\LoadViewer; use OCP\App\IAppManager; use OCP\AppFramework\Controller; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\Attribute\UseSession; use OCP\AppFramework\Http\ContentSecurityPolicy; use OCP\AppFramework\Http\NotFoundResponse; use OCP\AppFramework\Http\RedirectResponse; @@ -126,13 +127,13 @@ class PageController extends Controller { /** * @PublicPage * @NoCSRFRequired - * @UseSession * @BruteForceProtection(action=talkRoomToken) * * @param string $token * @return Response * @throws HintException */ + #[UseSession] public function showCall(string $token): Response { // This is the entry point from the `/call/{token}` URL which is hardcoded in the server. return $this->index($token); @@ -141,7 +142,6 @@ class PageController extends Controller { /** * @PublicPage * @NoCSRFRequired - * @UseSession * @BruteForceProtection(action=talkRoomPassword) * * @param string $token @@ -149,6 +149,7 @@ class PageController extends Controller { * @return Response * @throws HintException */ + #[UseSession] public function authenticatePassword(string $token, string $password = ''): Response { // This is the entry point from the `/call/{token}` URL which is hardcoded in the server. return $this->index($token, '', $password); @@ -177,7 +178,6 @@ class PageController extends Controller { /** * @PublicPage * @NoCSRFRequired - * @UseSession * @BruteForceProtection(action=talkRoomToken) * * @param string $token @@ -186,6 +186,7 @@ class PageController extends Controller { * @return TemplateResponse|RedirectResponse * @throws HintException */ + #[UseSession] public function index(string $token = '', string $callUser = '', string $password = ''): Response { $bruteForceToken = $token; $user = $this->userSession->getUser(); |