Skip to content

Commit

Permalink
[BUGFIX] 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.

Fixes: TYPO3-Solr#3351
Relates: TYPO3-Solr#3347
Ports: TYPO3-Solr#3352
  • Loading branch information
dkd-kaehm committed Oct 11, 2023
1 parent 729324f commit fa6a3e7
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<pages>
<uid>2</uid>
<is_siteroot>0</is_siteroot>
<doktype>1</doktype>
<pid>1</pid>
<fe_group>1</fe_group>
</pages>
<pages>
<uid>3</uid>
<is_siteroot>0</is_siteroot>
<doktype>1</doktype>
<pid>1</pid>
<fe_group>-2</fe_group>
</pages>

<fe_groups>
<uid>1</uid>
<pid>1</pid>
<title>dummy group</title>
</fe_groups>
</dataset>
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->importDataSetFromFixture('can_initialize_tsfe_for_page_with_different_fe_groups_settings.xml');

$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 fa6a3e7

Please sign in to comment.