Commit 0127c68c authored by Markus Klein's avatar Markus Klein Committed by Benni Mack
Browse files

[BUGFIX] Do not try to evaluate fe_groups for page overlays

The access settings is an exclude field and hence
the value is synchronized to the translation.
Fetching the translation overlay therefore does
not need to evaluate the fe_groups again.

Resolves: #91725
Releases: master, 10.4, 9.5
Change-Id: Ie6ec2208d15f67eafb6a48627c5f1b76ffdc5725
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66330


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent f8363ceb
......@@ -534,9 +534,8 @@ class PageRepository implements LoggerAwareInterface
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
$queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class, $this->context));
if (empty($this->where_groupAccess)) {
$queryBuilder->getRestrictions()->removeByType(FrontendGroupRestriction::class);
}
// Because "fe_group" is an exclude field, so it is synced between overlays, the group restriction is removed for language overlays of pages
$queryBuilder->getRestrictions()->removeByType(FrontendGroupRestriction::class);
$result = $queryBuilder->select('*')
->from('pages')
->where(
......
......@@ -62,9 +62,8 @@ class PageRepositoryTest extends FunctionalTestCase
$subject = new PageRepository();
$rows = $subject->getMenu(2, 'uid, title');
self::assertArrayHasKey(5, $rows);
self::assertArrayHasKey(6, $rows);
self::assertArrayHasKey(7, $rows);
self::assertCount(3, $rows);
self::assertCount(2, $rows);
}
/**
......@@ -75,11 +74,10 @@ class PageRepositoryTest extends FunctionalTestCase
$subject = new PageRepository();
$rows = $subject->getMenu([2, 3], 'uid, title');
self::assertArrayHasKey(5, $rows);
self::assertArrayHasKey(6, $rows);
self::assertArrayHasKey(7, $rows);
self::assertArrayHasKey(8, $rows);
self::assertArrayHasKey(9, $rows);
self::assertCount(5, $rows);
self::assertCount(4, $rows);
}
/**
......@@ -93,11 +91,10 @@ class PageRepositoryTest extends FunctionalTestCase
$rows = $subject->getMenu([2, 3], 'uid, title');
self::assertEquals('Attrappe 1-2-5', $rows[5]['title']);
self::assertEquals('Attrappe 1-2-6', $rows[6]['title']);
self::assertEquals('Dummy 1-2-7', $rows[7]['title']);
self::assertEquals('Dummy 1-3-8', $rows[8]['title']);
self::assertEquals('Attrappe 1-3-9', $rows[9]['title']);
self::assertCount(5, $rows);
self::assertCount(4, $rows);
}
/**
......@@ -245,6 +242,29 @@ class PageRepositoryTest extends FunctionalTestCase
self::assertEquals(1, $row['_PAGES_OVERLAY_LANGUAGE']);
}
/**
* @test
*/
public function groupRestrictedPageCanBeOverlaid()
{
$subject = new PageRepository();
$origRow = $subject->getPage(6, true);
$subject = new PageRepository(new Context([
'language' => new LanguageAspect(1)
]));
$rows = $subject->getPagesOverlay([$origRow]);
self::assertIsArray($rows);
self::assertCount(1, $rows);
self::assertArrayHasKey(0, $rows);
$row = $rows[0];
$this->assertOverlayRow($row);
self::assertEquals('Attrappe 1-2-6', $row['title']);
self::assertEquals('905', $row['_PAGES_OVERLAY_UID']);
self::assertEquals(1, $row['_PAGES_OVERLAY_LANGUAGE']);
}
/**
* @test
*/
......
......@@ -42,6 +42,7 @@
<title>Dummy 1-2-6</title>
<deleted>0</deleted>
<perms_everybody>15</perms_everybody>
<fe_group>-2</fe_group>
</pages>
<pages>
<uid>7</uid>
......@@ -121,6 +122,7 @@
<sys_language_uid>1</sys_language_uid>
<title>Attrappe 1-2-6</title>
<deleted>0</deleted>
<fe_group>-2</fe_group>
</pages>
<pages>
<uid>906</uid>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment