Skip to content

Commit

Permalink
[TEST] TSFE can not be initialized for pages with fe_group="-2"
Browse files Browse the repository at this point in the history
The TSFE can not be initialized in record-monitoring(BE editiing) context for pages, 
whichs fe_group is set to -2(show if fe_user is logged in).

This leads to following behavior:
* After editing the [sub]pages in BE, the page is removed from index and never indexed again.
* By reinitialization of pages index queue the page is indexed as expected with expected groups.

Relates: TYPO3-Solr#3351, TYPO3-Solr#3347
  • Loading branch information
dkd-kaehm committed Oct 13, 2023
1 parent bbdda0c commit 9da29e1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"pages",
,"uid","is_siteroot","doktype","pid","fe_group"
,"2","0","1","1","1"
,"3","0","1","1","-2"
"fe_groups",
,"uid","pid","title"
,"1","1","dummy group"
34 changes: 34 additions & 0 deletions Tests/Integration/FrontendEnvironment/TsfeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use ApacheSolrForTypo3\Solr\Tests\Integration\IntegrationTest;
use RuntimeException;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

class TsfeTest extends IntegrationTest
{
Expand Down Expand Up @@ -53,4 +54,37 @@ public function initializeTsfeWithNoDefaultPageAndPageErrorHandlerDoNotThrowAnEr
$tsfeManager = GeneralUtility::makeInstance(Tsfe::class);
$tsfeManager->getTsfeByPageIdAndLanguageId(1);
}

/**
* @test
*/
public function canInitializeTsfeForPageWithDifferentFeGroupsSettings()
{
$this->writeDefaultSolrTestSiteConfiguration();
$this->importCSVDataSet(__DIR__ . '/Fixtures/can_initialize_tsfe_for_page_with_different_fe_groups_settings.csv');

$tsfeNotRestricted = GeneralUtility::makeInstance(Tsfe::class)->getTsfeByPageIdIgnoringLanguage(1);
self::assertInstanceOf(
TypoScriptFrontendController::class,
$tsfeNotRestricted,
'The TSFE can not be initialized at all, nor for public page either for access restricted(fe_group) page. ' .
'Most probably nothing will work.'
);

$tsfeRestrictedForExistingFeGroup = GeneralUtility::makeInstance(Tsfe::class)->getTsfeByPageIdIgnoringLanguage(2);
self::assertInstanceOf(
TypoScriptFrontendController::class,
$tsfeRestrictedForExistingFeGroup,
'The TSFE can not be initialized for existing fe_group. ' .
'This will lead to failures on editing the access restricted [sub]pages in BE.'
);

$tsfeForLoggedInUserOnly = GeneralUtility::makeInstance(Tsfe::class)->getTsfeByPageIdIgnoringLanguage(3);
self::assertInstanceOf(
TypoScriptFrontendController::class,
$tsfeForLoggedInUserOnly,
'The TSFE can not be initialized for page with fe_group="-2". ' .
'This will lead to failures on editing the [sub]pages in BE for pages with fe_group="-2".'
);
}
}

0 comments on commit 9da29e1

Please sign in to comment.