Bug #96381
closedFrontend preview doesn't work on restricted pages
100%
Description
The frontend-preview of restricted pages doesn't work.
An example:
The TYPO3-page 'mytypo3page' is restricted by the fe_groups-record with UID 4884. When i click the frontend-preview-button in the TYPO3-backend-module 'page', than
TYPO3 is calling this URL:
https://mytypo3domain.com/mytypo3page?ADMCMD_simUser=4884
The result in an 404-pageNotFound-error, because of this:
1. TYPO3\CMS\Frontend\Middleware\PreviewSimulator::simulateUserGroup will create the aspect 'frontend.user' (with an logged-in FE-user).
2. Later (during the FE-rendering) TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::fetch_the_id will initialize the FE-userGroups, by calling '$this->initUserGroups()'.
3. TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::initUserGroups overrides the already existing aspect 'frontend.user' (with an 'empty' FE-user).
So, we must fix the bug in TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::initUserGroups:
public function initUserGroups()
{
if ($this->isInPreviewMode() &&
$this->context->getAspect('frontend.user')->isLoggedIn() ) {
// do NOT create userAspect! Because that would overwrite the already
// existing userAspect, which was created in TYPO3\CMS\Frontend\Middleware\PreviewSimulator::process()
return;
}
$userAspect = $this->fe_user->createUserAspect((bool)$this->loginAllowedInBranch);
$this->context->setAspect('frontend.user', $userAspect);
}
Files
Updated by Oliver Hader almost 3 years ago
- Status changed from New to Accepted
Sounds reasonable to avoid initializing groups again...
Updated by Benni Mack almost 3 years ago
Hey Jürgen,
I guess the one thing we should do is properly populate the UserGroups in the PreviewSimulator class. PreviewSimulator does not populate $fe_user->userGroups properly...
Updated by Gerrit Code Review almost 3 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/73121
Updated by Gerrit Code Review almost 3 years ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/73121
Updated by Gerrit Code Review almost 3 years ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/73121
Updated by Gerrit Code Review almost 3 years ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/73121
Updated by Gerrit Code Review almost 3 years ago
Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/73154
Updated by Benni Mack almost 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset d585717e451fbbe8452775f2259a461197bbef51.
Updated by Oliver Bartsch almost 2 years ago
- Related to Bug #99718: Admin Panel Simulate user group added