From 17cb5b9d097ea361d070beff02c6412b5c1c5602 Mon Sep 17 00:00:00 2001 From: medofrh Date: Wed, 1 Jul 2026 12:38:19 +0200 Subject: [PATCH 1/8] Add .DS_Store to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 055339d..c28b5b4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ public public/* index.html composer.lock +.DS_Store # User-specific stuff: From 00ecd4ba2517f112a1f5e33fb621e07981f73d05 Mon Sep 17 00:00:00 2001 From: medofrh Date: Wed, 1 Jul 2026 22:27:01 +0200 Subject: [PATCH 2/8] replace old utility with strategy pattern for Scalability --- Classes/Controller/ProtectionController.php | 4 ++ Classes/Domain/Model/Protection.php | 44 +--------------- Classes/Middleware/AccessMiddleware.php | 5 +- Classes/Service/AccessService.php | 34 +++++++++++++ .../Utility/Access/AccessUtilityInterface.php | 13 +++++ .../Utility/Access/BeLoginAccessUtility.php | 43 ++++++++++++++++ .../Utility/Access/FeLoginAccessUtility.php | 46 +++++++++++++++++ Configuration/Services.yaml | 16 ++++++ ...pfileprotector_domain_model_protection.php | 6 +-- Resources/Private/Partials/Access/Be.html | 3 ++ Resources/Private/Partials/Access/Fe.html | 51 +++++++++++++++++++ .../Partials/Protection/FormFields.html | 50 ++---------------- 12 files changed, 220 insertions(+), 95 deletions(-) create mode 100644 Classes/Service/AccessService.php create mode 100644 Classes/Utility/Access/AccessUtilityInterface.php create mode 100644 Classes/Utility/Access/BeLoginAccessUtility.php create mode 100644 Classes/Utility/Access/FeLoginAccessUtility.php create mode 100644 Resources/Private/Partials/Access/Be.html create mode 100644 Resources/Private/Partials/Access/Fe.html diff --git a/Classes/Controller/ProtectionController.php b/Classes/Controller/ProtectionController.php index e4ea5d7..7a4518f 100644 --- a/Classes/Controller/ProtectionController.php +++ b/Classes/Controller/ProtectionController.php @@ -9,6 +9,7 @@ use Fixpunkt\FpFileprotector\Domain\Repository\FrontendUserGroupRepository; use Fixpunkt\FpFileprotector\Domain\Repository\FrontendUserRepository; use Fixpunkt\FpFileprotector\Domain\Repository\ProtectionRepository; +use Fixpunkt\FpFileprotector\Service\AccessService; use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Backend\Attribute\AsController; use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; @@ -28,6 +29,7 @@ public function __construct( protected readonly FrontendUserGroupRepository $userGroupRepository, protected readonly FrontendUserRepository $userRepository, protected readonly FolderRepository $folderRepository, + protected readonly AccessService $accessService, ) { $querySettings = GeneralUtility::makeInstance(Typo3QuerySettings::class); $querySettings->setRespectStoragePage(false); @@ -50,6 +52,7 @@ public function newAction(string $combinedIdentifier): ResponseInterface 'folder' => $this->folderRepository->findOneByCombinedIdentifier($combinedIdentifier), 'userGroups' => $this->userGroupRepository->findAll(), 'users' => $this->userRepository->findAll(), + 'accessPartials' => $this->accessService->getPartials(), ]); return $moduleTemplate->renderResponse('Protection/New'); @@ -87,6 +90,7 @@ public function editAction(Protection $protection): ResponseInterface 'folder' => $protection->getFolderObject(), 'userGroups' => $this->userGroupRepository->findAll(), 'users' => $this->userRepository->findAll(), + 'accessPartials' => $this->accessService->getPartials(), ]); return $moduleTemplate->renderResponse('Protection/Edit'); diff --git a/Classes/Domain/Model/Protection.php b/Classes/Domain/Model/Protection.php index 069073e..57b8818 100644 --- a/Classes/Domain/Model/Protection.php +++ b/Classes/Domain/Model/Protection.php @@ -6,8 +6,6 @@ use Fixpunkt\FpFileprotector\Domain\Repository\FolderRepository; use Fixpunkt\FpFileprotector\Resource\Folder; -use Fixpunkt\FpFileprotector\Utility\FrontendUserUtility; -use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; use TYPO3\CMS\Extbase\Persistence\ObjectStorage; @@ -177,50 +175,12 @@ public function removeUser(FrontendUser $user): void } /** - * Checks whether the current user is allowed to access the resource. - * - * @return bool - */ - public function isGranted(): bool - { - if ($this->isFeLogin()) { - $frontendUserUtility = GeneralUtility::makeInstance(FrontendUserUtility::class); - $feUser = $frontendUserUtility->getCurrentFrontendUser(); - if ($feUser && $feUser->isLoggedIn()) { - if ($this->getUserGroups()->count() === 0 && $this->getUsers()->count() === 0) { - return true; - } - - if (in_array($feUser->get('id'), $this->getUsersUids(), true)) { - return true; - } - - foreach ($feUser->get('groupIds') as $userGroupId) { - if (in_array($userGroupId, $this->getUserGroupsUids(), true)) { - return true; - } - } - } - } - - $context = GeneralUtility::makeInstance(Context::class); - if ( - $this->isBeLogin() - && (bool)$context->getPropertyFromAspect('backend.user', 'isLoggedIn') - ) { - return true; - } - - return false; - } - - /** - * Returns whether the folder protection applies any restrictions. + * Returns whether the folder protection applies any FE restrictions. * * @return bool */ public function isProtected(): bool { - return $this->isFeLogin() || $this->isBeLogin(); + return $this->isFeLogin(); } } diff --git a/Classes/Middleware/AccessMiddleware.php b/Classes/Middleware/AccessMiddleware.php index 5bfe457..05bf017 100644 --- a/Classes/Middleware/AccessMiddleware.php +++ b/Classes/Middleware/AccessMiddleware.php @@ -5,6 +5,7 @@ namespace Fixpunkt\FpFileprotector\Middleware; use Fixpunkt\FpFileprotector\Domain\Repository\ProtectionRepository; +use Fixpunkt\FpFileprotector\Service\AccessService; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\MiddlewareInterface; @@ -20,6 +21,8 @@ class AccessMiddleware implements MiddlewareInterface { + public function __construct(private readonly AccessService $accessService) {} + public function process( ServerRequestInterface $request, RequestHandlerInterface $handler @@ -82,7 +85,7 @@ public function process( } $protection = ProtectionRepository::getProtectionStatic($folder); - if ((!$protection && !$protectedByDefault) || ($protection && $protection->isGranted())) { + if ((!$protection && !$protectedByDefault) || ($protection && $this->accessService->isGranted($protection))) { return $this->releaseFile($storage, $filePath); } return $this->createError(LocalizationUtility::translate('sys_file_storage.errors.access_denied', 'FpFileprotector'), 500); diff --git a/Classes/Service/AccessService.php b/Classes/Service/AccessService.php new file mode 100644 index 0000000..6736b4e --- /dev/null +++ b/Classes/Service/AccessService.php @@ -0,0 +1,34 @@ + $accessUtilities */ + public function __construct(private readonly iterable $accessUtilities) {} + + public function isGranted(Protection $protection): bool + { + foreach ($this->accessUtilities as $utility) { + if ($utility->isGranted($protection)) { + return true; + } + } + return false; + } + + /** @return string[] */ + public function getPartials(): array + { + $partials = []; + foreach ($this->accessUtilities as $utility) { + $partials[] = $utility->getPartial(); + } + return $partials; + } +} diff --git a/Classes/Utility/Access/AccessUtilityInterface.php b/Classes/Utility/Access/AccessUtilityInterface.php new file mode 100644 index 0000000..4c007d3 --- /dev/null +++ b/Classes/Utility/Access/AccessUtilityInterface.php @@ -0,0 +1,13 @@ +isLoggedIn()) { + return false; + } + + if ($beUser->isAdmin()) { + return true; + } + + foreach ($beUser->getFileStorages() as $storage) { + if ($storage->getUid() !== $protection->getStorage()) { + continue; + } + try { + $folder = $storage->getFolder($protection->getFolder()); + return $storage->isWithinFileMountBoundaries($folder, false); + } catch (\Exception) { + return false; + } + } + + return false; + } + + public function getPartial(): string + { + return 'Access/Be'; + } +} diff --git a/Classes/Utility/Access/FeLoginAccessUtility.php b/Classes/Utility/Access/FeLoginAccessUtility.php new file mode 100644 index 0000000..25ee9d4 --- /dev/null +++ b/Classes/Utility/Access/FeLoginAccessUtility.php @@ -0,0 +1,46 @@ +isFeLogin()) { + return false; + } + + $feUser = $this->frontendUserUtility->getCurrentFrontendUser(); + if (!$feUser || !$feUser->isLoggedIn()) { + return false; + } + + if ($protection->getUserGroups()->count() === 0 && $protection->getUsers()->count() === 0) { + return true; + } + + if (in_array($feUser->get('id'), $protection->getUsersUids(), true)) { + return true; + } + + foreach ($feUser->get('groupIds') as $userGroupId) { + if (in_array($userGroupId, $protection->getUserGroupsUids(), true)) { + return true; + } + } + + return false; + } + + public function getPartial(): string + { + return 'Access/Fe'; + } +} diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index de9f1ed..c614b37 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -5,6 +5,11 @@ services: autoconfigure: true public: true + _instanceof: + Fixpunkt\FpFileprotector\Utility\Access\AccessUtilityInterface: + tags: + - { name: 'fp_fileprotector.access' } + Fixpunkt\FpFileprotector\: resource: '../Classes/*' exclude: @@ -12,6 +17,17 @@ services: - '../Classes/Resource/*' - '../Classes/Utility/*' + Fixpunkt\FpFileprotector\Utility\Access\: + resource: '../Classes/Utility/Access/*' + + # Utilities needed for DI + Fixpunkt\FpFileprotector\Utility\FrontendUserUtility: ~ + + # Inject all tagged access utilities into AccessService + Fixpunkt\FpFileprotector\Service\AccessService: + arguments: + $accessUtilities: !tagged_iterator 'fp_fileprotector.access' + Fixpunkt\FpFileprotector\EventListener\ModifyIconForResourcePropertiesListener: tags: - name: event.listener diff --git a/Configuration/TCA/tx_fpfileprotector_domain_model_protection.php b/Configuration/TCA/tx_fpfileprotector_domain_model_protection.php index 83fc312..6831d2b 100644 --- a/Configuration/TCA/tx_fpfileprotector_domain_model_protection.php +++ b/Configuration/TCA/tx_fpfileprotector_domain_model_protection.php @@ -21,13 +21,9 @@ 'label' => 'LLL:EXT:fp_fileprotector/Resources/Private/Language/locallang.xlf:tx_fpfileprotector_domain_model_protection.palette.fe', 'showitem' => 'fe_login,--linebreak--,user_groups,--linebreak--,users', ], - 'be' => [ - 'label' => 'LLL:EXT:fp_fileprotector/Resources/Private/Language/locallang.xlf:tx_fpfileprotector_domain_model_protection.palette.be', - 'showitem' => 'be_login', - ], ], 'types' => [ - 0 => ['showitem' => '--palette--;;folder,--palette--;;fe,--palette--;;be'], + 0 => ['showitem' => '--palette--;;folder,--palette--;;fe'], ], 'columns' => [ 'storage' => [ diff --git a/Resources/Private/Partials/Access/Be.html b/Resources/Private/Partials/Access/Be.html new file mode 100644 index 0000000..3396fdf --- /dev/null +++ b/Resources/Private/Partials/Access/Be.html @@ -0,0 +1,3 @@ +

+ +

\ No newline at end of file diff --git a/Resources/Private/Partials/Access/Fe.html b/Resources/Private/Partials/Access/Fe.html new file mode 100644 index 0000000..c6555d5 --- /dev/null +++ b/Resources/Private/Partials/Access/Fe.html @@ -0,0 +1,51 @@ +

+ +

+
+ +
+
+
+
+ + +
+
+ +
+ +
+ +
+
+
+
+
+
+
+ + +
+
+ +
+ +
+ +
+
+
+
+
+
\ No newline at end of file diff --git a/Resources/Private/Partials/Protection/FormFields.html b/Resources/Private/Partials/Protection/FormFields.html index 613e821..4eba5c9 100644 --- a/Resources/Private/Partials/Protection/FormFields.html +++ b/Resources/Private/Partials/Protection/FormFields.html @@ -1,47 +1,3 @@ -

- -

-
- -
-
-
-
- - -
-
- -
-
-
-
-
-
-
- - -
-
- -
-
-
-
-
-
- -

- -

-
- -
\ No newline at end of file + + + \ No newline at end of file From e4173471ad756fb7ef8b6d615274df2b8ba0c054 Mon Sep 17 00:00:00 2001 From: medofrh Date: Thu, 2 Jul 2026 15:30:59 +0200 Subject: [PATCH 3/8] Fix login check in BeLoginAccessUtility to use user UID --- Classes/Utility/Access/BeLoginAccessUtility.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Utility/Access/BeLoginAccessUtility.php b/Classes/Utility/Access/BeLoginAccessUtility.php index 98e388f..ce41e3a 100644 --- a/Classes/Utility/Access/BeLoginAccessUtility.php +++ b/Classes/Utility/Access/BeLoginAccessUtility.php @@ -13,7 +13,7 @@ public function isGranted(Protection $protection): bool { /** @var BackendUserAuthentication|null $beUser */ $beUser = $GLOBALS['BE_USER'] ?? null; - if (!$beUser || !$beUser->isLoggedIn()) { + if (!$beUser || empty($beUser->user['uid'])) { return false; } From 8bb5901557952b8d97fa7dac063bcf2014ed360b Mon Sep 17 00:00:00 2001 From: medofrh Date: Thu, 2 Jul 2026 15:41:07 +0200 Subject: [PATCH 4/8] Refactor error handling in AccessMiddleware to use a dedicated translate method for localization --- Classes/Middleware/AccessMiddleware.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Classes/Middleware/AccessMiddleware.php b/Classes/Middleware/AccessMiddleware.php index 05bf017..4059011 100644 --- a/Classes/Middleware/AccessMiddleware.php +++ b/Classes/Middleware/AccessMiddleware.php @@ -47,7 +47,7 @@ public function process( $storage = $this->getStorage($storageIdentifier); if (!$storage) { - return $this->createError(LocalizationUtility::translate('sys_file_storage.errors.storage_not_found', 'FpFileprotector')); + return $this->createError($this->translate('sys_file_storage.errors.storage_not_found')); } $protected = $storage->getStorageRecord()['protected']; $protectedByDefault = $storage->getStorageRecord()['protected_by_default']; @@ -68,7 +68,7 @@ public function process( ) ) ) { - return $this->createError(LocalizationUtility::translate('sys_file_storage.errors.file_not_found', 'FpFileprotector')); + return $this->createError($this->translate('sys_file_storage.errors.file_not_found')); } $originalFile = $file; if ($originalFile instanceof ProcessedFile) { @@ -81,14 +81,14 @@ public function process( $folder = $originalFile->getParentFolder(); if (!$folder) { - return $this->createError(LocalizationUtility::translate('sys_file_storage.errors.folder_not_found', 'FpFileprotector')); + return $this->createError($this->translate('sys_file_storage.errors.folder_not_found')); } $protection = ProtectionRepository::getProtectionStatic($folder); if ((!$protection && !$protectedByDefault) || ($protection && $this->accessService->isGranted($protection))) { return $this->releaseFile($storage, $filePath); } - return $this->createError(LocalizationUtility::translate('sys_file_storage.errors.access_denied', 'FpFileprotector'), 500); + return $this->createError($this->translate('sys_file_storage.errors.access_denied'), 500); } /** @@ -110,6 +110,15 @@ private function getStorage(string $identifier): ?ResourceStorage return null; } + private function translate(string $key): string + { + try { + return LocalizationUtility::translate($key, 'FpFileprotector') ?? $key; + } catch (\Throwable) { + return $key; + } + } + /** * Returns an error response. * @@ -137,7 +146,7 @@ private function releaseFile(ResourceStorage $storage, string $fileIdentifier): { $file = $storage->getFile($fileIdentifier); if (!$file) { - return $this->createError(LocalizationUtility::translate('sys_file_storage.errors.file_release_not_found', 'FpFileprotector')); + return $this->createError($this->translate('sys_file_storage.errors.file_release_not_found')); } $body = new Stream('php://temp', 'rw'); From b8c8384dc1ad62ede51c1e79c723b61a23db182e Mon Sep 17 00:00:00 2001 From: medofrh Date: Thu, 2 Jul 2026 15:47:54 +0200 Subject: [PATCH 5/8] Fix type casting for protected fields in FileStorageRepository and update form fields for proper checkbox handling --- Classes/Domain/Repository/FileStorageRepository.php | 4 ++-- Resources/Private/Partials/FileStorage/FormFields.html | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Classes/Domain/Repository/FileStorageRepository.php b/Classes/Domain/Repository/FileStorageRepository.php index 17e6b3f..a2bce89 100644 --- a/Classes/Domain/Repository/FileStorageRepository.php +++ b/Classes/Domain/Repository/FileStorageRepository.php @@ -60,8 +60,8 @@ public function update(ResourceStorage $fileStorage): void $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('sys_file_storage')->createQueryBuilder(); $queryBuilder ->update('sys_file_storage') - ->set('protected', $fileStorage->isProtected()) - ->set('protected_by_default', $fileStorage->isProtectedByDefault() ?: 0) + ->set('protected', (int)$fileStorage->isProtected()) + ->set('protected_by_default', (int)$fileStorage->isProtectedByDefault()) ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($fileStorage->getUid()))) ->executeStatement(); } diff --git a/Resources/Private/Partials/FileStorage/FormFields.html b/Resources/Private/Partials/FileStorage/FormFields.html index 7495198..996b109 100644 --- a/Resources/Private/Partials/FileStorage/FormFields.html +++ b/Resources/Private/Partials/FileStorage/FormFields.html @@ -1,10 +1,12 @@
\ No newline at end of file From ab66f9c5bc17ceded64473efd94d696cea6883dc Mon Sep 17 00:00:00 2001 From: medofrh Date: Tue, 7 Jul 2026 12:24:28 +0200 Subject: [PATCH 6/8] Add folder identifier to edit and htaccess URIs in FolderController --- Classes/Controller/FolderController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/Controller/FolderController.php b/Classes/Controller/FolderController.php index 7060aab..a17cef6 100644 --- a/Classes/Controller/FolderController.php +++ b/Classes/Controller/FolderController.php @@ -95,9 +95,9 @@ protected function initializeDocHeader(ModuleTemplate $moduleTemplate, Folder $f $moduleTemplate->getDocHeaderComponent()->setMetaInformationForResource($folder); $editStorageUri = $this->uriBuilder->reset() - ->uriFor('edit', ['fileStorageUid' => $folder->getStorage()->getUid()], 'FileStorage'); + ->uriFor('edit', ['fileStorageUid' => $folder->getStorage()->getUid(), 'id' => $folder->getCombinedIdentifier()], 'FileStorage'); $htaccessUri = $this->uriBuilder->reset() - ->uriFor('htaccess', ['fileStorageUid' => $folder->getStorage()->getUid()], 'FileStorage'); + ->uriFor('htaccess', ['fileStorageUid' => $folder->getStorage()->getUid(), 'id' => $folder->getCombinedIdentifier()], 'FileStorage'); // add buttons $buttonBar = $moduleTemplate->getDocHeaderComponent()->getButtonBar(); From bb8023319f5eb173c1c438e1967ef543d775da12 Mon Sep 17 00:00:00 2001 From: medofrh Date: Tue, 7 Jul 2026 13:48:17 +0200 Subject: [PATCH 7/8] Make protection properties display dynamic with one partial per access right. --- Classes/Controller/FolderController.php | 7 ++- Classes/Service/AccessService.php | 10 ++++ .../Utility/Access/AccessUtilityInterface.php | 1 + .../Utility/Access/BeLoginAccessUtility.php | 5 ++ .../Utility/Access/FeLoginAccessUtility.php | 5 ++ Resources/Private/Partials/Properties/Be.html | 11 ++++ Resources/Private/Partials/Properties/Fe.html | 41 ++++++++++++++ .../Partials/Protection/Properties.html | 53 ++----------------- Resources/Private/Templates/Folder/Show.html | 2 +- 9 files changed, 83 insertions(+), 52 deletions(-) create mode 100644 Resources/Private/Partials/Properties/Be.html create mode 100644 Resources/Private/Partials/Properties/Fe.html diff --git a/Classes/Controller/FolderController.php b/Classes/Controller/FolderController.php index a17cef6..1ea8e7d 100644 --- a/Classes/Controller/FolderController.php +++ b/Classes/Controller/FolderController.php @@ -6,6 +6,7 @@ use Fixpunkt\FpFileprotector\Domain\Repository\FolderRepository; use Fixpunkt\FpFileprotector\Resource\Folder; +use Fixpunkt\FpFileprotector\Service\AccessService; use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Backend\Attribute\AsController; use TYPO3\CMS\Backend\Template\Components\ButtonBar; @@ -29,6 +30,7 @@ public function __construct( protected readonly IconFactory $iconFactory, protected readonly FolderRepository $folderRepository, protected readonly StorageRepository $storageRepository, + protected readonly AccessService $accessService, ) {} /** @@ -56,7 +58,10 @@ public function showAction(string $id = "", bool $refreshFolderTree = false): Re $moduleTemplate = $this->moduleTemplateFactory->create($this->request); $this->initializeDocHeader($moduleTemplate, $folder); $this->statusCheck($folder); - $moduleTemplate->assign('folder', $folder); + $moduleTemplate->assignMultiple([ + 'folder' => $folder, + 'propertiesPartials' => $this->accessService->getPropertiesPartials(), + ]); return $moduleTemplate->renderResponse('Folder/Show'); } diff --git a/Classes/Service/AccessService.php b/Classes/Service/AccessService.php index 6736b4e..6f49cc1 100644 --- a/Classes/Service/AccessService.php +++ b/Classes/Service/AccessService.php @@ -31,4 +31,14 @@ public function getPartials(): array } return $partials; } + + /** @return string[] */ + public function getPropertiesPartials(): array + { + $partials = []; + foreach ($this->accessUtilities as $utility) { + $partials[] = $utility->getPropertiesPartial(); + } + return $partials; + } } diff --git a/Classes/Utility/Access/AccessUtilityInterface.php b/Classes/Utility/Access/AccessUtilityInterface.php index 4c007d3..90df01b 100644 --- a/Classes/Utility/Access/AccessUtilityInterface.php +++ b/Classes/Utility/Access/AccessUtilityInterface.php @@ -10,4 +10,5 @@ interface AccessUtilityInterface { public function isGranted(Protection $protection): bool; public function getPartial(): string; + public function getPropertiesPartial(): string; } diff --git a/Classes/Utility/Access/BeLoginAccessUtility.php b/Classes/Utility/Access/BeLoginAccessUtility.php index ce41e3a..a56cc93 100644 --- a/Classes/Utility/Access/BeLoginAccessUtility.php +++ b/Classes/Utility/Access/BeLoginAccessUtility.php @@ -40,4 +40,9 @@ public function getPartial(): string { return 'Access/Be'; } + + public function getPropertiesPartial(): string + { + return 'Properties/Be'; + } } diff --git a/Classes/Utility/Access/FeLoginAccessUtility.php b/Classes/Utility/Access/FeLoginAccessUtility.php index 25ee9d4..1455611 100644 --- a/Classes/Utility/Access/FeLoginAccessUtility.php +++ b/Classes/Utility/Access/FeLoginAccessUtility.php @@ -43,4 +43,9 @@ public function getPartial(): string { return 'Access/Fe'; } + + public function getPropertiesPartial(): string + { + return 'Properties/Fe'; + } } diff --git a/Resources/Private/Partials/Properties/Be.html b/Resources/Private/Partials/Properties/Be.html new file mode 100644 index 0000000..b41746d --- /dev/null +++ b/Resources/Private/Partials/Properties/Be.html @@ -0,0 +1,11 @@ +
+
+
+ + + + +
+
diff --git a/Resources/Private/Partials/Properties/Fe.html b/Resources/Private/Partials/Properties/Fe.html new file mode 100644 index 0000000..1a40307 --- /dev/null +++ b/Resources/Private/Partials/Properties/Fe.html @@ -0,0 +1,41 @@ +
+
+
+ + + + +
+
+ + +
+
+ +
    + +
  • {userGroup.title}
  • +
    +
+
+
+
+ +
+
+ +
    + +
  • {user.username}
  • +
    +
+
+
+
+
diff --git a/Resources/Private/Partials/Protection/Properties.html b/Resources/Private/Partials/Protection/Properties.html index de0a61d..33c2dec 100644 --- a/Resources/Private/Partials/Protection/Properties.html +++ b/Resources/Private/Partials/Protection/Properties.html @@ -1,52 +1,5 @@
-
-
-
- - - - -
-
- - -
-
- -
    - -
  • {userGroup.title}
  • -
    -
-
-
-
- -
-
- -
    - -
  • {user.username}
  • -
    -
-
-
-
-
+ + +
-
-
- - - - -
\ No newline at end of file diff --git a/Resources/Private/Templates/Folder/Show.html b/Resources/Private/Templates/Folder/Show.html index 7be8fbf..3cafb5f 100644 --- a/Resources/Private/Templates/Folder/Show.html +++ b/Resources/Private/Templates/Folder/Show.html @@ -44,7 +44,7 @@

{folder.speakingName}

- +
From f62073aa8871e83e7e9850bb223398a8d55ed52c Mon Sep 17 00:00:00 2001 From: medofrh Date: Tue, 7 Jul 2026 14:03:39 +0200 Subject: [PATCH 8/8] Remove translate in AccessMiddleware --- Classes/Middleware/AccessMiddleware.php | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/Classes/Middleware/AccessMiddleware.php b/Classes/Middleware/AccessMiddleware.php index 4059011..d119a8e 100644 --- a/Classes/Middleware/AccessMiddleware.php +++ b/Classes/Middleware/AccessMiddleware.php @@ -17,7 +17,6 @@ use TYPO3\CMS\Core\Resource\ResourceStorage; use TYPO3\CMS\Core\Resource\StorageRepository; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Utility\LocalizationUtility; class AccessMiddleware implements MiddlewareInterface { @@ -47,7 +46,7 @@ public function process( $storage = $this->getStorage($storageIdentifier); if (!$storage) { - return $this->createError($this->translate('sys_file_storage.errors.storage_not_found')); + return $this->createError('The storage could not be found.'); } $protected = $storage->getStorageRecord()['protected']; $protectedByDefault = $storage->getStorageRecord()['protected_by_default']; @@ -68,7 +67,7 @@ public function process( ) ) ) { - return $this->createError($this->translate('sys_file_storage.errors.file_not_found')); + return $this->createError('The file could not be found.'); } $originalFile = $file; if ($originalFile instanceof ProcessedFile) { @@ -81,14 +80,14 @@ public function process( $folder = $originalFile->getParentFolder(); if (!$folder) { - return $this->createError($this->translate('sys_file_storage.errors.folder_not_found')); + return $this->createError('The storage location could not be found.'); } $protection = ProtectionRepository::getProtectionStatic($folder); if ((!$protection && !$protectedByDefault) || ($protection && $this->accessService->isGranted($protection))) { return $this->releaseFile($storage, $filePath); } - return $this->createError($this->translate('sys_file_storage.errors.access_denied'), 500); + return $this->createError('You do not have permission to access this file.', 500); } /** @@ -110,15 +109,6 @@ private function getStorage(string $identifier): ?ResourceStorage return null; } - private function translate(string $key): string - { - try { - return LocalizationUtility::translate($key, 'FpFileprotector') ?? $key; - } catch (\Throwable) { - return $key; - } - } - /** * Returns an error response. * @@ -146,7 +136,7 @@ private function releaseFile(ResourceStorage $storage, string $fileIdentifier): { $file = $storage->getFile($fileIdentifier); if (!$file) { - return $this->createError($this->translate('sys_file_storage.errors.file_release_not_found')); + return $this->createError('The requested file could not be found.'); } $body = new Stream('php://temp', 'rw');