[BUGFIX] Do not let sites module render rootpages in workspaces 02/58202/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Thu, 6 Sep 2018 14:26:14 +0000 (16:26 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 7 Sep 2018 16:14:12 +0000 (18:14 +0200)
If root pages are configured in workspaces, such pages must not get
rendered in the sites module. The BackendWorkspaceRestriction is added
to prevent fetching such pages in the LIVE workspace.

Resolves: #86174
Releases: master
Change-Id: I35a614d41125516a65cd1d2bce917c04f6af57ac
Reviewed-on: https://review.typo3.org/58202
Reviewed-by: Willi Wehmeier <wwwehmeier@gmail.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: rolandgolla <rolandgolla@gmail.com>
Tested-by: rolandgolla <rolandgolla@gmail.com>
Reviewed-by: Joerg Kummer <typo3@enobe.de>
Tested-by: Joerg Kummer <typo3@enobe.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/backend/Classes/Controller/SiteConfigurationController.php

index 1d5faf5..34fedaf 100644 (file)
@@ -31,6 +31,7 @@ use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Configuration\SiteConfiguration;
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Database\ConnectionPool;
+use TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction;
 use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
 use TYPO3\CMS\Core\Exception\SiteNotFoundException;
 use TYPO3\CMS\Core\Http\HtmlResponse;
@@ -602,6 +603,7 @@ class SiteConfigurationController
     {
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
         $queryBuilder->getRestrictions()->removeByType(HiddenRestriction::class);
+        $queryBuilder->getRestrictions()->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class, 0, false));
         $statement = $queryBuilder
             ->select('*')
             ->from('pages')