Skip to content

Commit 0beac3d

Browse files
committed
[BUGFIX] Allow to visit pages if editor has no access
When an editor (non-admin) is logged in in the backend, and is logged into the frontend with a usergroup as well, the user is not allowed to view to a access-restricted page for which the BE admin has no access - even though the frontend is accessible with the regular fe permission rights of the FE usergroup in the session. This happens because the Preview simulation takes place in the Frontend (PreviewSimulator middleware) first, then evaluates that a preview should be shown (due to a ADMCMD_simUser=1 for example), and then checks - once the page is resolved - if the BE editor has access to the page - because he/she is logged in. In this case, when a BE editor is logged in and has no permission to actually see the page due to BE restrictions, it is ADDITIONALLY checked now if the record can be previewed with the current Context information via the AccessVoter. Resolves: #101589 Resolves: #105567 Resolves: #105866 Related: #97176 Releases: main, 13.4, 12.4 Change-Id: Ic78792eb6892e9af1ac4632ca777f3210ee34d2d Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/88762 Reviewed-by: Benni Mack <benni@typo3.org> Tested-by: Georg Ringer <georg.ringer@gmail.com> Reviewed-by: Georg Ringer <georg.ringer@gmail.com> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Andreas Kienast <akienast@scripting-base.de> Tested-by: Andreas Kienast <akienast@scripting-base.de> Tested-by: core-ci <typo3@b13.com>
1 parent 0a5ac4d commit 0beac3d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

typo3/sysext/frontend/Classes/Page/PageInformationFactory.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,9 +530,17 @@ protected function checkCrossDomainWithDirectId(ServerRequestInterface $request,
530530
*/
531531
protected function checkBackendUserAccess(ServerRequestInterface $request, PageInformation $pageInformation): void
532532
{
533-
if ($this->context->getPropertyFromAspect('backend.user', 'isLoggedIn', false)
534-
&& $this->context->getPropertyFromAspect('frontend.preview', 'isPreview', false)
535-
&& !$GLOBALS['BE_USER']->doesUserHaveAccess($pageInformation->getPageRecord(), Permission::PAGE_SHOW)
533+
// No backend user was logged in, nothing to check
534+
if (!$this->context->getPropertyFromAspect('backend.user', 'isLoggedIn', false)) {
535+
return;
536+
}
537+
// PreviewSimulator did not detect anything
538+
if (!$this->context->getPropertyFromAspect('frontend.preview', 'isPreview', false)) {
539+
return;
540+
}
541+
// Editor has no show permission for this page PLUS regular user is not allowed to see the page? 403.
542+
if (!$GLOBALS['BE_USER']->doesUserHaveAccess($pageInformation->getPageRecord(), Permission::PAGE_SHOW)
543+
&& !$this->accessVoter->accessGranted('pages', $pageInformation->getPageRecord(), $this->context)
536544
) {
537545
$response = $this->errorController->accessDeniedAction(
538546
$request,

0 commit comments

Comments
 (0)