Bug #90842

FE user restriction on pages and link incl. linkAccessRestrictedPages create wrong URLs

Added by Tim Lochmüller 7 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2020-03-26
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
7.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hey guys,

I have a page with frontend user restriction and try to link to this page.
The default language link is right, but the links in all other languages are wrong (language segment + default language slug)

Example: (tested with TYPO3 9.5.14)
<f:link.page pageUid="{PID_OF_FE_USER_RESTRICTED_PAGE}" linkAccessRestrictedPages="1">LINK</f:link.page>

Expected result:
DE: /startseite
EN: /en/home

Current result:
The link on a english page is: /en/startseite (the correct language segment, but the default language slug)

Reason:

The function \TYPO3\CMS\Frontend\Typolink\PageLinkBuilder->build respect "linkAccessRestrictedPages" in $disableGroupAccessCheck
but this variable is only used for the page selection AND NOT for the page language overlay in this line: $pageRepository->getPageOverlay($page);

More details:
\TYPO3\CMS\Frontend\Page\PageRepository->getPageOverlaysForLanguageUids uses always this restriction in the selection:
$queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));

So currently "linkAccessRestrictedPages" is not working with multi language setups.

Any help or ideas for a good solution?

Regards,
Tim


Related issues

Related to TYPO3 Core - Bug #87969: Page route for translated page is not generated correctly when page has frontend group access restrictions Closed 2019-03-20
Related to TYPO3 Core - Bug #91725: PageLinkBuilder: disableGroupAccessCheck doesn't work for translated pages with fegroup restriction New 2020-06-29
Duplicates TYPO3 Core - Bug #91045: Language overlay does not respect $disableGroupAccessCheck Closed 2020-04-15

Associated revisions

Revision 56269a97 (diff)
Added by Benni Mack 6 months ago

[BUGFIX] Use correct slug for access restricted translated pages

Access restricted, translated pages currently always have the slug from the
default language instead of their translated slug in the frontend.
To generate correct urls, while using the "linkAccessRestrictedPages"
option, the $disableGroupAccessCheck parameter needs to also take into
account for * PageRepository::getPageOverlay()
when setting the option in PageRepository::getPage().

This "hack" is currently similar to what HMENU is doing, however
this public property should not be used with the Context API instead.

This change however needs more refactoring on the Context API,
which is why this solution is chosen for the time being (and also
for v9 backport).

Resolves: #90842
Resolves: #87969
Resolves: #91185
Releases: master, 9.5
Change-Id: I99a34ca7fceacba7218c6b7132781805a6b59ac9
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63963
Tested-by: TYPO3com <>
Tested-by: Jonas Eberle <>
Tested-by: Benni Mack <>
Reviewed-by: Jonas Eberle <>
Reviewed-by: Helmut Hummel <>
Reviewed-by: Benni Mack <>

Revision 4978699f (diff)
Added by Benni Mack 6 months ago

[BUGFIX] Use correct slug for access restricted translated pages

Access restricted, translated pages currently always have the slug from the
default language instead of their translated slug in the frontend.
To generate correct urls, while using the "linkAccessRestrictedPages"
option, the $disableGroupAccessCheck parameter needs to also take into
account for * PageRepository::getPageOverlay()
when setting the option in PageRepository::getPage().

This "hack" is currently similar to what HMENU is doing, however
this public property should not be used with the Context API instead.

This change however needs more refactoring on the Context API,
which is why this solution is chosen for the time being (and also
for v9 backport).

Resolves: #90842
Resolves: #87969
Resolves: #91185
Releases: master, 9.5
Change-Id: I99a34ca7fceacba7218c6b7132781805a6b59ac9
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64359
Tested-by: TYPO3com <>
Tested-by: Benni Mack <>
Reviewed-by: Benni Mack <>

History

#1 Updated by Tim Lochmüller 7 months ago

  • Category set to Link Handling, Site Handling & Routing

#2 Updated by Christian Eßl 7 months ago

On it.

#3 Updated by Gerrit Code Review 7 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63963

#4 Updated by Christian Eßl 7 months ago

  • Related to Bug #87969: Page route for translated page is not generated correctly when page has frontend group access restrictions added

#5 Updated by Gerrit Code Review 7 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63963

#6 Updated by Christian Eßl 6 months ago

  • Duplicates Bug #91045: Language overlay does not respect $disableGroupAccessCheck added

#7 Updated by Jonas Eberle 6 months ago

Same as with https://forge.typo3.org/issues/87969 for me:

I can only reproduce in 9.5.15 if linking to a page whose parent is also access restricted.

The incorrect link is then <language prefix of translated language>/<slug of default language>.

#8 Updated by Gerrit Code Review 6 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63963

#9 Updated by Gerrit Code Review 6 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63963

#10 Updated by Gerrit Code Review 6 months ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64359

#11 Updated by Benni Mack 6 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#12 Updated by Gerrit Code Review 6 months ago

  • Status changed from Resolved to Under Review

Patch set 2 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64359

#13 Updated by Benni Mack 6 months ago

  • Status changed from Under Review to Resolved

#14 Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed

#15 Updated by Markus Klein 4 months ago

  • Related to Bug #91725: PageLinkBuilder: disableGroupAccessCheck doesn't work for translated pages with fegroup restriction added

Also available in: Atom PDF