Skip to content

Commit

Permalink
[BUGFIX] Allow fe_group modification when indexing subpage of restric…
Browse files Browse the repository at this point in the history
…ted page

Fixes #3969
  • Loading branch information
Roman Schilter authored and dkd-kaehm committed Apr 5, 2024
1 parent 8be36a2 commit 871eb5a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Classes/EventListener/PageIndexer/FrontendGroupsModifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,20 @@ class FrontendGroupsModifier
public function __invoke(ModifyResolvedFrontendGroupsEvent $event): void
{
$pageIndexerRequest = $event->getRequest()->getAttribute('solr.pageIndexingInstructions');
if (!$pageIndexerRequest instanceof PageIndexerRequest
|| (
(int)$pageIndexerRequest->getParameter('userGroup') === 0
&& (
(int)$pageIndexerRequest->getParameter('pageUserGroup') !== -2
&&
(int)$pageIndexerRequest->getParameter('pageUserGroup') < 1
)
if (!$pageIndexerRequest instanceof PageIndexerRequest) {
return;
}

$groups = $this->resolveFrontendUserGroups($pageIndexerRequest);

$noRelevantFrontendUserGroupResolved = empty($groups) || (count($groups) === 1 && $groups[0] === 0);
if ((int)$pageIndexerRequest->getParameter('userGroup') === 0
&& (
(int)$pageIndexerRequest->getParameter('pageUserGroup') !== -2
&&
(int)$pageIndexerRequest->getParameter('pageUserGroup') < 1
)
&& $noRelevantFrontendUserGroupResolved
) {
return;
}
Expand Down Expand Up @@ -76,7 +81,6 @@ public function __invoke(ModifyResolvedFrontendGroupsEvent $event): void
);
}

$groups = $this->resolveFrontendUserGroups($pageIndexerRequest);
if ((int)$pageIndexerRequest->getParameter('pageUserGroup') > 0) {
$groups[] = (int)$pageIndexerRequest->getParameter('pageUserGroup');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"fe_groups",
,"uid","pid","title"
,1,1,"group 1"
"pages",
,"uid","pid","is_siteroot","doktype","slug","title","subtitle","crdate","tstamp","fe_group",extendToSubpages
,2,1,0,1,"/protected_page","protected page","",1449151778,1449151778,1,1
,3,2,0,1,/sub_page,sub page, ,1449151779,1449151779,0,0
"tt_content",
,"uid","pid","CType","header","fe_group","sorting"
,10,3,"header",public content of protected page,0,10
"tx_solr_indexqueue_item",
,"uid","root","item_type","item_uid","indexing_configuration","changed","indexed","has_indexing_properties","indexing_priority","indexed","errors"
,4711,1,"pages",3,"pages",1449151778,0,0,0,0,0
11 changes: 11 additions & 0 deletions Tests/Integration/IndexQueue/PageIndexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,17 @@ public static function canIndexPageWithAccessProtectedContentIntoSolrDataProvide
'protected ce',
],
];

yield 'page protected by extend to subpages' => [
'can_index_sub_page_of_protected_page_with_extend_to_subpage',
1,
[
'2:1/c:0',
],
[
'public content of protected page',
],
];
}

/**
Expand Down

0 comments on commit 871eb5a

Please sign in to comment.