diff --git a/composer/composer/autoload_classmap.php b/composer/composer/autoload_classmap.php index 1a3b568da..da85631f4 100644 --- a/composer/composer/autoload_classmap.php +++ b/composer/composer/autoload_classmap.php @@ -45,7 +45,7 @@ return array( 'OCA\\Text\\Listeners\\NodeCopiedListener' => $baseDir . '/../lib/Listeners/NodeCopiedListener.php', 'OCA\\Text\\Listeners\\RegisterDirectEditorEventListener' => $baseDir . '/../lib/Listeners/RegisterDirectEditorEventListener.php', 'OCA\\Text\\Middleware\\Attribute\\RequireDocumentSession' => $baseDir . '/../lib/Middleware/Attribute/RequireDocumentSession.php', - 'OCA\\Text\\Middleware\\Attribute\\RequireDocumentSessionUserOrShareToken' => $baseDir . '/../lib/Middleware/Attribute/RequireDocumentSessionUserOrShareToken.php', + 'OCA\\Text\\Middleware\\Attribute\\RequireDocumentSessionOrUserOrShareToken' => $baseDir . '/../lib/Middleware/Attribute/RequireDocumentSessionOrUserOrShareToken.php', 'OCA\\Text\\Middleware\\SessionMiddleware' => $baseDir . '/../lib/Middleware/SessionMiddleware.php', 'OCA\\Text\\Migration\\ResetSessionsBeforeYjs' => $baseDir . '/../lib/Migration/ResetSessionsBeforeYjs.php', 'OCA\\Text\\Migration\\Version010000Date20190617184535' => $baseDir . '/../lib/Migration/Version010000Date20190617184535.php', diff --git a/composer/composer/autoload_static.php b/composer/composer/autoload_static.php index 853a5a55a..8732ef4a1 100644 --- a/composer/composer/autoload_static.php +++ b/composer/composer/autoload_static.php @@ -60,7 +60,7 @@ class ComposerStaticInitText 'OCA\\Text\\Listeners\\NodeCopiedListener' => __DIR__ . '/..' . '/../lib/Listeners/NodeCopiedListener.php', 'OCA\\Text\\Listeners\\RegisterDirectEditorEventListener' => __DIR__ . '/..' . '/../lib/Listeners/RegisterDirectEditorEventListener.php', 'OCA\\Text\\Middleware\\Attribute\\RequireDocumentSession' => __DIR__ . '/..' . '/../lib/Middleware/Attribute/RequireDocumentSession.php', - 'OCA\\Text\\Middleware\\Attribute\\RequireDocumentSessionUserOrShareToken' => __DIR__ . '/..' . '/../lib/Middleware/Attribute/RequireDocumentSessionUserOrShareToken.php', + 'OCA\\Text\\Middleware\\Attribute\\RequireDocumentSessionOrUserOrShareToken' => __DIR__ . '/..' . '/../lib/Middleware/Attribute/RequireDocumentSessionOrUserOrShareToken.php', 'OCA\\Text\\Middleware\\SessionMiddleware' => __DIR__ . '/..' . '/../lib/Middleware/SessionMiddleware.php', 'OCA\\Text\\Migration\\ResetSessionsBeforeYjs' => __DIR__ . '/..' . '/../lib/Migration/ResetSessionsBeforeYjs.php', 'OCA\\Text\\Migration\\Version010000Date20190617184535' => __DIR__ . '/..' . '/../lib/Migration/Version010000Date20190617184535.php', diff --git a/lib/Controller/AttachmentController.php b/lib/Controller/AttachmentController.php index 373f60d93..19ec885da 100644 --- a/lib/Controller/AttachmentController.php +++ b/lib/Controller/AttachmentController.php @@ -29,7 +29,7 @@ use Exception; use OCA\Text\Exception\InvalidSessionException; use OCA\Text\Exception\UploadException; use OCA\Text\Middleware\Attribute\RequireDocumentSession; -use OCA\Text\Middleware\Attribute\RequireDocumentSessionUserOrShareToken; +use OCA\Text\Middleware\Attribute\RequireDocumentSessionOrUserOrShareToken; use OCA\Text\Service\AttachmentService; use OCP\AppFramework\ApiController; use OCP\AppFramework\Http; @@ -85,7 +85,7 @@ class AttachmentController extends ApiController implements ISessionAwareControl #[NoAdminRequired] #[PublicPage] - #[RequireDocumentSessionUserOrShareToken] + #[RequireDocumentSessionOrUserOrShareToken] public function getAttachmentList(?string $shareToken = null): DataResponse { $documentId = $this->getDocument()->getId(); try { @@ -192,7 +192,7 @@ class AttachmentController extends ApiController implements ISessionAwareControl #[NoAdminRequired] #[PublicPage] #[NoCSRFRequired] - #[RequireDocumentSessionUserOrShareToken] + #[RequireDocumentSessionOrUserOrShareToken] public function getImageFile(string $imageFileName, ?string $shareToken = null, int $preferRawImage = 0): DataResponse|DataDownloadResponse { $documentId = $this->getDocument()->getId(); @@ -227,7 +227,7 @@ class AttachmentController extends ApiController implements ISessionAwareControl #[NoAdminRequired] #[PublicPage] #[NoCSRFRequired] - #[RequireDocumentSessionUserOrShareToken] + #[RequireDocumentSessionOrUserOrShareToken] public function getMediaFile(string $mediaFileName, ?string $shareToken = null): DataResponse|DataDownloadResponse { $documentId = $this->getDocument()->getId(); @@ -258,7 +258,7 @@ class AttachmentController extends ApiController implements ISessionAwareControl #[NoAdminRequired] #[PublicPage] #[NoCSRFRequired] - #[RequireDocumentSessionUserOrShareToken] + #[RequireDocumentSessionOrUserOrShareToken] public function getMediaFilePreview(string $mediaFileName, ?string $shareToken = null) { $documentId = $this->getDocument()->getId(); diff --git a/lib/Middleware/Attribute/RequireDocumentSessionUserOrShareToken.php b/lib/Middleware/Attribute/RequireDocumentSessionOrUserOrShareToken.php similarity index 68% rename from lib/Middleware/Attribute/RequireDocumentSessionUserOrShareToken.php rename to lib/Middleware/Attribute/RequireDocumentSessionOrUserOrShareToken.php index b5127e4d3..d9cc863fe 100644 --- a/lib/Middleware/Attribute/RequireDocumentSessionUserOrShareToken.php +++ b/lib/Middleware/Attribute/RequireDocumentSessionOrUserOrShareToken.php @@ -5,5 +5,5 @@ namespace OCA\Text\Middleware\Attribute; use Attribute; #[Attribute(Attribute::TARGET_METHOD)] -class RequireDocumentSessionUserOrShareToken { +class RequireDocumentSessionOrUserOrShareToken { } diff --git a/lib/Middleware/SessionMiddleware.php b/lib/Middleware/SessionMiddleware.php index 30f259967..613b83b2a 100644 --- a/lib/Middleware/SessionMiddleware.php +++ b/lib/Middleware/SessionMiddleware.php @@ -5,7 +5,7 @@ namespace OCA\Text\Middleware; use OCA\Text\Controller\ISessionAwareController; use OCA\Text\Exception\InvalidSessionException; use OCA\Text\Middleware\Attribute\RequireDocumentSession; -use OCA\Text\Middleware\Attribute\RequireDocumentSessionUserOrShareToken; +use OCA\Text\Middleware\Attribute\RequireDocumentSessionOrUserOrShareToken; use OCA\Text\Service\DocumentService; use OCA\Text\Service\SessionService; use OCP\AppFramework\Controller; @@ -36,7 +36,7 @@ class SessionMiddleware extends \OCP\AppFramework\Middleware { $reflectionMethod = new \ReflectionMethod($controller, $methodName); - if (!empty($reflectionMethod->getAttributes(RequireDocumentSessionUserOrShareToken::class))) { + if (!empty($reflectionMethod->getAttributes(RequireDocumentSessionOrUserOrShareToken::class))) { try { $this->assertDocumentSession($controller); } catch (InvalidSessionException) {