Skip to content

Commit

Permalink
Check rootline for feGroups from page with extendToSubpages set
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Horstmann authored and dkd-kaehm committed May 13, 2024
1 parent 4bde076 commit 1d6ae0e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Classes/FrontendEnvironment/Tsfe.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,20 @@ protected function initializeTsfe(int $pageId, int $language = 0, ?int $rootPage
$userGroups = explode(',', $pageRecord['fe_group']);
} else {
$userGroups = [0, -1];

// Check rootline for feGroups from page with extendToSubpages set
$rootline = BackendUtility::BEgetRootLine($pageId);
// remove the current page from the rootline
array_shift($rootline);
foreach ($rootline as $page) {
// Skip root node, invalid pages and pages which do not define extendToSubpages
if ((int)($page['uid'] ?? 0) <= 0 || !($page['extendToSubpages'] ?? false)) {
continue;
}
$userGroups = explode(',', $page['fe_group']);
// Stop as soon as a page in the rootline has extendToSubpages set
break;
}
}
$feUser->user = ['uid' => 0, 'username' => '', 'usergroup' => implode(',', $userGroups) ];
$feUser->fetchGroupData($serverRequest);
Expand Down

0 comments on commit 1d6ae0e

Please sign in to comment.