diff --git a/contao/dca/tl_page.php b/contao/dca/tl_page.php index caa2f79..d1e02c2 100755 --- a/contao/dca/tl_page.php +++ b/contao/dca/tl_page.php @@ -1,4 +1,5 @@ |null */ @@ -42,10 +46,11 @@ class MissingLanguageIconListener implements ResetInterface */ private ?array $translationCache = null; - public function __construct(TokenStorageInterface $tokenStorage, Connection $connection) + public function __construct(TokenStorageInterface $tokenStorage, Connection $connection, AuthorizationCheckerInterface $authorizationChecker) { $this->tokenStorage = $tokenStorage; $this->connection = $connection; + $this->authorizationChecker = $authorizationChecker; } /** @@ -83,7 +88,12 @@ private function onPageLabel(array $args, $previousResult = null): string $label = $previousResult; } - if ('root' === $row['type'] || 'folder' === $row['type'] || 'page' !== Input::get('do')) { + if ( + 'root' === $row['type'] + || 'folder' === $row['type'] + || 'page' !== Input::get('do') + || !$this->authorizationChecker->isGranted(ContaoCorePermissions::USER_CAN_EDIT_FIELD_OF_TABLE, 'tl_page.languageMain') + ) { return $label; } @@ -129,7 +139,10 @@ private function onArticleLabel(array $args, $previousResult = null): string $label = $previousResult; } - if (!$row['showTeaser']) { + if ( + !$row['showTeaser'] + || !$this->authorizationChecker->isGranted(ContaoCorePermissions::USER_CAN_EDIT_FIELD_OF_TABLE, 'tl_article.languageMain') + ) { return $label; } @@ -155,6 +168,10 @@ private function onNewsChildRecords(array $args, $previousResult = null): string $label = '
'.$row['headline'].' ['.Date::parse(Config::get('datimFormat'), $row['date']).']
'; } + if (!$this->authorizationChecker->isGranted(ContaoCorePermissions::USER_CAN_EDIT_FIELD_OF_TABLE, 'tl_news.languageMain')) { + return $label; + } + if (0 === $this->getChildTranslation((int) $row['id'], 'tl_news', 'tl_news_archive', 'master')) { return preg_replace( '##', @@ -178,6 +195,10 @@ private function onCalendarEventChildRecords(array $args, $previousResult = null $row = $args[0]; $label = (string) $previousResult; + if (!$this->authorizationChecker->isGranted(ContaoCorePermissions::USER_CAN_EDIT_FIELD_OF_TABLE, 'tl_calendar_events.languageMain')) { + return $label; + } + if (0 === $this->getChildTranslation((int) $row['id'], 'tl_calendar_events', 'tl_calendar', 'master')) { return preg_replace( '##', @@ -201,6 +222,10 @@ private function onFaqChildRecords(array $args, $previousResult = null): string $row = $args[0]; $label = (string) $previousResult; + if (!$this->authorizationChecker->isGranted(ContaoCorePermissions::USER_CAN_EDIT_FIELD_OF_TABLE, 'tl_faq.languageMain')) { + return $label; + } + if (0 === $this->getChildTranslation((int) $row['id'], 'tl_faq', 'tl_faq_category', 'master')) { return preg_replace( '##',