Review main Merged

94040[BUGFIX] Fix workspace split preview URLs for access-restricted pages

Philipp Kitzberger CR +2 V +2 Hard +376 −40 updated 11/19/26, 08:25

Commit message

Two issues affected the draft URL in the workspace split preview:

1) The draft URL always resolved to the site root instead of the
correct page path when the page had an fe_group restriction. The
draft URL was generated using workspace context (workspace > 0),
which caused PageRepository::getPage() to invoke versionOL(). Inside
versionOL(), getWorkspaceVersionOfRecord() runs an enable-fields check
via FrontendRestrictionContainer. In a backend context there is no
frontend user, so FrontendGroupRestriction only permits pages where
fe_group is empty or '0'. Any other restriction caused the check to
return -2, versionOL() set $row to false, getPage() returned an empty
array, and the generated URL path became '/' (site root).

The live URL was unaffected because it already used an explicit
workspace=0 context which causes versionOL() to return immediately
without any enable-fields checks. The draft URL keeps the workspace
context, so slugs changed or created in the workspace, e.g. of a
translation that only exists there, are still used. Instead, the
simulated frontend user groups are now set on the context, so the
draft version passes FrontendGroupRestriction. The group -2 ("show at
any login") is added as well, as any logged-in frontend user has it.

2) When a page's live and workspace versions are protected by different
fe_groups (e.g. fe_group=1 in live, fe_group=2 in workspace), the
draft URL produced either a 403 or a 404. The frontend checks the
restriction of the live page record, and versionOL() then checks the
restriction of the workspace version overlaying it. The simulated
frontend user set by ADMCMD_simUser must therefore satisfy both
restrictions. The PreviewController now merges both group ID lists
for the draft URL.

PreviewSimulator::simulateUserGroup() previously only accepted a
single integer group ID. It now accepts a comma-separated list so the
merged group set can be passed via a single ADMCMD_simUser parameter.
The fe_user usergroup_column is a comma-separated varchar field and
FrontendGroupRestriction uses FIND_IN_SET(), so multiple groups are
natively supported at the database level.

The admin panel reads ADMCMD_simUser as well and now simulates every
group of the list instead of only the first one. Its middleware is now
declared to run before the preview simulator, so the preview parameters
take precedence over the admin panel settings.

The new internal PreviewSimulatorCalculator in EXT:frontend converts
between the ADMCMD_simUser parameter and group IDs, and is used by
PreviewSimulator, the admin panel and PreviewController.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Josua Vogel +1
  • Verified V +2 Done
    • Benni Mack +2
    • Josua Vogel +1
    • core-ci +1 CI

Issues 1

Files 10

Review log 2845

Show 1120 earlier messages
  1. Philipp Kitzberger uploaded patch set 1 05/08/26, 13:36

  2. Benni Mack updated the commit message in patch set 2 05/08/26, 13:39

  3. core-ci voted on patch set 2 V +1 05/08/26, 13:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101730

  4. core-ci voted on patch set 1 V +1 05/08/26, 14:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101728

  5. Philipp Kitzberger uploaded patch set 3 V +1 05/09/26, 08:50

  6. core-ci voted on patch set 3 V +1 05/09/26, 08:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/101751

  7. Philipp Kitzberger uploaded patch set 4 V +1 05/21/26, 10:55

  8. core-ci voted on patch set 4 V -1 05/21/26, 11:02 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102311

  9. Philipp Kitzberger uploaded patch set 5 V -1 05/25/26, 07:24

  10. core-ci voted on patch set 5 V +1 05/25/26, 07:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102399

  11. Josua Vogel voted on patch set 5 CR +1 V +1 09/09/26, 10:18

  12. Benni Mack commented on patch set 5 09/09/26, 10:21

    looking at the code, I'd really like to have a test for the PreviewController as well, so we know that any further changes won't break this again. In addition, we could build a small PreviewSimulatorCalculator in EXT:frontend that does the conversion, and both PreviewSimulator and PreviewController consuem the class. This way, we only need to (unit-) test the new class. WDYT?
  13. Josua Vogel uploaded patch set 6 CR +1 V +1 09/09/26, 12:09

  14. core-ci voted on patch set 6 V +1 09/09/26, 12:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108174

  15. Josua Vogel uploaded patch set 7 V +1 09/09/26, 12:41

  16. Josua Vogel uploaded patch set 8 09/09/26, 12:43

  17. core-ci voted on patch set 7 V -1 09/09/26, 12:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108178

  18. core-ci voted on patch set 8 V -1 09/09/26, 12:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108179

  19. Josua Vogel uploaded patch set 9 V -1 09/09/26, 13:48

  20. core-ci voted on patch set 9 V -1 09/09/26, 13:57 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108188

  1. Josua Vogel uploaded patch set 10 V -1 10/22/26, 20:10

  2. Josua Vogel commented on patch set 10 10/22/26, 20:12

    Reply

    Done
  3. core-ci voted on patch set 10 V +1 10/22/26, 20:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112185

  4. Benni Mack uploaded patch set 11 V +1 11/01/26, 07:13

  5. core-ci voted on patch set 11 V -1 11/01/26, 07:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112993

  6. Benni Mack rebased onto patch set 12 V -1 11/01/26, 11:42

  7. core-ci voted on patch set 12 V +1 11/01/26, 11:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/113011

  8. Josua Vogel uploaded patch set 13 V +1 11/03/26, 11:57

  9. Josua Vogel commented on patch set 13 11/03/26, 12:02

    added -2 as simulated user group
  10. core-ci voted on patch set 13 V -1 11/03/26, 12:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/113152

  11. core-ci voted on patch set 13 V +1 11/03/26, 13:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/113152

  12. Josua Vogel voted on patch set 13 CR +1 V +1 11/03/26, 13:29

  13. Simon Schaufelberger voted on patch set 13 CR +1 V +1 11/06/26, 00:55

  14. Benni Mack commented on patch set 13 11/09/26, 15:45

    We still need to adapt "admin panel" logic as well. Maybe we can centralize this completely? not just for simUser but also fro simTime.
  15. Benni Mack voted on patch set 13 CR -1 11/09/26, 15:45

  16. Benni Mack uploaded patch set 14 CR +1 V +1 11/18/26, 20:29

  17. core-ci voted on patch set 14 V +1 11/18/26, 20:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114921

  18. Benni Mack uploaded patch set 15 V +1 11/18/26, 22:05

  19. Benni Mack uploaded patch set 16 11/18/26, 22:13

  20. core-ci voted on patch set 15 V +1 11/18/26, 22:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114935

  21. core-ci voted on patch set 16 V +1 11/18/26, 22:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114936

  22. Benni Mack voted on patch set 16 CR +1 V +1 11/19/26, 07:13

  23. Josua Vogel voted on patch set 16 CR +1 V +1 11/19/26, 07:51

  24. Benni Mack voted on patch set 16 CR +2 V +2 11/19/26, 08:21

  25. Benni Mack merged patch set 17 11/19/26, 08:25