Merge conflict
Gerrit cannot merge this change. It needs a rebase onto main.
98275[BUGFIX] Simulate restricted ancestors in preview
Commit message
A page can have two or more ancestors with "extendToSubpages" set. The frontend checks the restriction of the page and of each of these ancestors. The preview link of the page simulates the user groups and the access time of one page only. Thus the frontend denies the preview with a 403 response. The link must pass all restrictions that the frontend checks for a visitor. A restriction that grants access needs no simulation. The new internal method RecordAccessVoter::getRestrictionDenyingAccess() returns only the values of a restriction that deny access. It dispatches RecordAccessGrantedEvent in the same way as accessGranted(). Both methods now use the same private checks for the hidden flag, the start time and the end time. accessGranted() keeps its behaviour. PageAccessRestrictionResolver now returns only the restrictions that deny access, for the page and for each ancestor with "extendToSubpages". It gets them from the new voter method. AccessRestrictionSimulator now combines all these restrictions and no longer selects one of them. The link simulates all their user groups, and an access time after the latest start time and before the earliest end time. The caller can give a context that includes hidden and scheduled records. The workspace preview gives such a backend context. In this context, no start time and no end time deny access. Thus AccessRestrictionSimulator makes its own context of a visitor for the check. This context has the date and the workspace of the given context, and no frontend user. The link now simulates all groups that deny access, also when the given context has a frontend user. The link no longer simulates a start time or an end time that grants access at the date of the context. New tests in PreviewUriBuilderTest and PreviewSimulatorTest cover restricted ancestors and the context of a backend user. New tests in RecordAccessVoterTest cover the new voter method.
Show more Show less
Resolves: #111701 Related: #104081 Related: #96778 Releases: main, 14.3 Change-Id: Ie7c07ef9d1d7094ef1894cb30d742fe80fd7c217
Test this change
Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch
- Check out patch set 1
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/75/98275/1 && git checkout FETCH_HEAD
- Cherry-pick onto main
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/75/98275/1 && git cherry-pick FETCH_HEAD
Review
-
Code review CR 0 Needs a vote
-
Verified V 0 Needs a vote
- core-ci +1 CI
Relation chain 2
-
98275 [BUGFIX] Simulate restricted ancestors in preview This change
- 98274[TASK] Find inherited page restrictions in one place
Issues 3
Files 8
- typo3/sysext/backend/Classes/Routing/AccessRestrictionSimulator.php+37 −19
- typo3/sysext/backend/Tests/Functional/Routing/PreviewUriBuilderTest.php+247 −9
- typo3/sysext/core/Classes/Domain/Access/PageAccessRestrictionResolver.php+11 −7
- typo3/sysext/core/Classes/Domain/Access/RecordAccessVoter.php+77 −40
- typo3/sysext/core/Tests/Functional/Domain/Access/RecordAccessVoterTest.php+100 −0
- typo3/sysext/core/Tests/Unit/Domain/Access/PageAccessRestrictionResolverTest.php+20 −8
- typo3/sysext/frontend/Tests/Functional/Middleware/Fixtures/previewSimulatorCases.csv+4 −0
- typo3/sysext/frontend/Tests/Functional/Middleware/PreviewSimulatorTest.php+42 −0
Review log 12
-
Matthias Vogel uploaded patch set 1 12/02/26, 08:55
-
core-ci voted on patch set 1 V +1 12/02/26, 09:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/116162