[BUGFIX] Template module must respect workspaces 75/58175/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Mon, 3 Sep 2018 21:50:12 +0000 (23:50 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 4 Sep 2018 08:48:43 +0000 (10:48 +0200)
The template module now respects the workspace constraint of the current
backend user and the stored sys_template records.

Resolves: #86131
Releases: master, 8.7
Change-Id: I0463844c4222957aede4b4ca749a3368cb399f81
Reviewed-on: https://review.typo3.org/58175
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php

index d6f9701..92f0cb7 100644 (file)
@@ -18,6 +18,7 @@ use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Database\Query\QueryBuilder;
+use TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction;
 use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
 use TYPO3\CMS\Core\Exception;
 use TYPO3\CMS\Core\Imaging\Icon;
@@ -900,7 +901,9 @@ class ExtendedTemplateService extends TemplateService
             ->getQueryBuilderForTable('sys_template');
         $queryBuilder->getRestrictions()
             ->removeAll()
-            ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
+            ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
+            ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
+
         $queryBuilder->select('*')
             ->from('sys_template')
             ->where(