[BUGFIX] Allow workspace preview inside another rootline 13/55613/3
authorAlexander Opitz <opitz.alexander@googlemail.com>
Fri, 12 Jan 2018 16:08:07 +0000 (17:08 +0100)
committerSusanne Moog <susanne.moog@typo3.org>
Thu, 8 Feb 2018 19:38:23 +0000 (20:38 +0100)
The rootline for page view now depends on the webmounts of the workspace
the preview link was generated on and not the webmounts the beuser, who
generated the preview link, is at the moment of calling the preview
link.

Resolves: #83547
Releases: master, 8.7
Change-Id: I53c8d45260b79c4d5679f00084fe81b502668ee7
Reviewed-on: https://review.typo3.org/55613
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/workspaces/Classes/Hook/PreviewHook.php

index 0f1b12a..17d94cc 100644 (file)
@@ -115,6 +115,8 @@ class PreviewHook implements \TYPO3\CMS\Core\SingletonInterface
             $tempBackendUser->setBeUserByUid($this->previewConfiguration['BEUSER_uid']);
             if ($tempBackendUser->user['uid']) {
                 $tempBackendUser->unpack_uc();
+                $tempBackendUser->setTemporaryWorkspace($workspaceUid);
+                $tempBackendUser->user['workspace_id'] = $workspaceUid;
                 $tempBackendUser->fetchGroupData();
                 // Handle degradation of admin users
                 if ($tempBackendUser->isAdmin()) {
@@ -138,7 +140,7 @@ class PreviewHook implements \TYPO3\CMS\Core\SingletonInterface
                         ->execute()
                         ->fetch();
 
-                    // Either use configured workspace mount or current page id, if admin user does not have any page mounts
+                    // Either use configured workspace mount (of the workspace) or current page id
                     if (empty($tempBackendUser->groupData['webmounts'])) {
                         $tempBackendUser->groupData['webmounts'] = !empty($workspaceRecord['db_mountpoints']) ? $workspaceRecord['db_mountpoints'] : $pObj->id;
                     }