diff --git a/Classes/Form/Element/RedirectElement.php b/Classes/Form/Element/RedirectElement.php index 1684339..c73c4f8 100644 --- a/Classes/Form/Element/RedirectElement.php +++ b/Classes/Form/Element/RedirectElement.php @@ -5,6 +5,7 @@ namespace Ayacoo\RedirectTab\Form\Element; use Ayacoo\RedirectTab\Service\RedirectDemandService; +use Ayacoo\RedirectTab\UserFunctions\RedirectAccessDisplayCondition; use Psr\Http\Message\UriInterface; use TYPO3\CMS\Backend\Form\Element\AbstractFormElement; use TYPO3\CMS\Backend\Routing\UriBuilder; @@ -30,7 +31,9 @@ public function render(): array $this->prepareView(); + $redirectAccess = GeneralUtility::makeInstance(RedirectAccessDisplayCondition::class); $this->view->assignMultiple([ + 'canEditRedirects' => $redirectAccess->canEditRedirects(), 'redirects' => $redirectDemandService->getRedirects((int)$currentPage), 'demand' => $redirectDemandService->getDemand(), 'pagination' => $redirectDemandService->preparePagination($redirectDemandService->getDemand()), diff --git a/Classes/UserFunctions/RedirectAccessDisplayCondition.php b/Classes/UserFunctions/RedirectAccessDisplayCondition.php new file mode 100644 index 0000000..0e383b2 --- /dev/null +++ b/Classes/UserFunctions/RedirectAccessDisplayCondition.php @@ -0,0 +1,27 @@ +getBackendUser()->isAdmin() || $this->getBackendUser()->check('tables_select', self::TABLE_NAME); + } + + public function canEditRedirects(): bool + { + return $this->getBackendUser()->isAdmin() || $this->getBackendUser()->check('tables_modify', self::TABLE_NAME); + } + + protected function getBackendUser(): BackendUserAuthentication + { + return $GLOBALS['BE_USER']; + } +} diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php index fc8d880..bb7e0d9 100644 --- a/Configuration/TCA/Overrides/pages.php +++ b/Configuration/TCA/Overrides/pages.php @@ -1,5 +1,6 @@ [ 'AND' => [ 'REC:NEW:false', + 'USER:' . RedirectAccessDisplayCondition::class . '->canListRedirects', ], ], 'exclude' => true, diff --git a/Resources/Private/Templates/Backend/List.html b/Resources/Private/Templates/Backend/List.html index 865c147..10ed067 100644 --- a/Resources/Private/Templates/Backend/List.html +++ b/Resources/Private/Templates/Backend/List.html @@ -64,26 +64,48 @@ - + - + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + - - - - - - @@ -96,9 +118,13 @@

- - - + + + + + + +
diff --git a/composer.json b/composer.json index aba47ff..24b27ef 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "ayacoo/redirect-tab", "type": "typo3-cms-extension", - "version": "4.0.4", + "version": "4.0.5", "description": "Show TYPO3 redirects in the page properties", "authors": [ { diff --git a/ext_emconf.php b/ext_emconf.php index b79face..0a82937 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -8,7 +8,7 @@ 'author_email' => 'info@ayacoo.de', 'state' => 'stable', 'clearCacheOnLoad' => 0, - 'version' => '4.0.4', + 'version' => '4.0.5', 'constraints' => [ 'depends' => [ 'typo3' => '13.4.24-13.4.99',