Review main Work in progress Stale

84879[FEATURE] Allow record fields permissions preview

Marcin Sągol CR 0 V -1 Hard +828 −2 updated 08/06/26, 22:34

Commit message

The "Allowed fields" (non_exclude_fields) section of the be_groups
form now offers a preview button per table group, which opens a
modal showing the record form of that table as it will be presented
to editors of the currently edited backend group.

The new `SelectCheckBoxExcludeFieldsElement` (renderType
`selectCheckBoxExcludeFields`) extends `SelectCheckBoxElement`,
which now provides a `renderPanelHeadingActions()` method that
extending classes can use to add buttons to a checkbox group
panel heading.

The workflow:

* Clicking the preview button submits the unsaved be_groups form
  data via AJAX (route: record_form_preview_prepare). It is stored
  in the session of the logged in backend user together with a
  one-time token, and the URL of the preview document is returned
* The preview document (route: record_form_preview) is opened in
  an iframe modal and rendered by `RecordFormPreviewController`
* The controller resolves the effective group permissions
  (including sub groups and the unsaved form values) using a
  detached `BackendUserAuthentication` instance, following the
  pattern of `UserInformationService::getGroupInformation()`;
  Neither `$GLOBALS['BE_USER']` nor `$GLOBALS['TCA']` are touched
* The record form is compiled through the regular FormEngine data
  compiling process (`TcaDatabaseRecord`). The record type and
  optionally removed `displayCond` definitions are passed in via
  the form data compiler input
* Columns marked as exclude in TCA that are not covered by the
  group's non_exclude_fields are removed - including exclude
  fields within FlexForm data structures. All remaining columns
  are rendered read-only

Since the preview renders the real form elements through the
regular rendering chain including their JavaScript assets, custom
form elements provided by extensions are supported without any
additional implementation effort.

Dedicated controls above the preview allow selecting a different
record type and ignoring `displayCond` definitions, since the
non-interactive form cannot switch types on its own. Reloading is
a plain GET form submission within the iframe.

The preview cannot be submitted: the form has no enabled submit
control and a small guard module cancels programmatic submissions,
e.g. through the FormEngine save hotkey.

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 18
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/79/84879/18 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/79/84879/18 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V -1 Blocked
    • core-ci -1 CI

Merge conflicts 19

Issues 1

Files 14

Review log 2747

Show 1222 earlier messages
  1. Marcin Sągol uploaded patch set 1 06/24/24, 09:49

  2. core-ci voted on patch set 1 V -1 06/24/24, 09:55 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60165

  3. Marcin Sągol uploaded patch set 2 V -1 06/24/24, 10:28

  4. core-ci voted on patch set 2 V -1 06/24/24, 10:34 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60168

  5. Christian Kuhn commented on patch set 2 06/24/24, 10:45

    i wonder if we *really* need the preview interface and couldn't handle something like that without. i had a better access list selection in mind when i designed formEngine rewrite back then in v7 / v8, and i think it would make sense to give me a chance having a look. has this additional interface been aligned with some other coreteam member, yet?
  6. Marcin Sągol commented on patch set 2 06/24/24, 12:14

    Reply Unresolved

    Now I have doubts if it should be introduced. Maybe the NodeInterface could be just extended to include this new renderPreview method. Now we have some incomaptibility: `Call to an undefined method TYPO3\CMS\Backend\Form\NodeInterface::renderPreview().` as i am calling the metod in `SingleFieldContainer` and the returned type from the `create()` method is NodeInterface: ``` if ((($options['context'] ?? 'live') === 'preview')) { return $this->nodeFactory->create($options)->renderPreview(); } ``` I have discussed the changes in abstract method with @bo@cedev.de, i am no 100% sure if he also agreed on the new interface back then.
  7. Marcin Sągol rebased onto patch set 3 V -1 06/26/24, 13:32

  8. core-ci voted on patch set 3 V -1 06/26/24, 13:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60390

  9. Marcin Sągol uploaded patch set 4 V -1 06/26/24, 13:55

  10. core-ci voted on patch set 4 V -1 06/26/24, 14:01 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60391

  11. Marcin Sągol uploaded patch set 5 V -1 06/26/24, 22:03

  12. core-ci voted on patch set 5 V -1 06/26/24, 22:10 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60419

  13. Marcin Sągol uploaded patch set 6 V -1 06/26/24, 22:27

  14. core-ci voted on patch set 6 V -1 06/26/24, 22:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60420

  15. Marcin Sągol uploaded patch set 7 V -1 06/26/24, 22:51

  16. core-ci voted on patch set 7 V -1 06/26/24, 22:57 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60421

  17. Marcin Sągol uploaded patch set 8 V -1 06/27/24, 09:35

  18. core-ci voted on patch set 8 V -1 06/27/24, 09:41 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60443

  19. Marcin Sągol uploaded patch set 9 V -1 06/27/24, 10:20

  20. Marcin Sągol uploaded patch set 10 06/27/24, 10:23

  21. core-ci voted on patch set 9 V -1 06/27/24, 10:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60446

  22. core-ci voted on patch set 10 V -1 06/27/24, 10:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60447

  1. core-ci commented on patch set 10 06/27/24, 10:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60447

  2. core-ci commented on patch set 10 06/27/24, 10:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60447

  3. Marcin Sągol rebased onto patch set 11 V -1 06/27/24, 20:27

  4. core-ci voted on patch set 11 V +1 06/27/24, 20:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60495

  5. Marcin Sągol rebased onto patch set 12 V +1 06/28/24, 10:14

  6. core-ci voted on patch set 12 V +1 06/28/24, 10:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60546

  7. Marcin Sągol uploaded patch set 13 V +1 06/30/24, 10:48

  8. core-ci voted on patch set 13 V +1 06/30/24, 10:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/60662

  9. Oskar Dydo uploaded patch set 14 V +1 09/05/24, 11:18

  10. core-ci voted on patch set 14 V -1 09/05/24, 11:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64856

  11. Oskar Dydo uploaded patch set 15 V -1 09/05/24, 11:38

  12. core-ci voted on patch set 15 V +1 09/05/24, 11:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/64861

  13. Guido Schmechel commented on patch set 15 V +1 09/07/24, 16:50

    Tested with a TYPO3 standard installation
  14. Oskar Dydo uploaded patch set 16 V +1 09/13/24, 09:45

  15. core-ci voted on patch set 16 V -1 09/13/24, 09:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/65650

  16. Oskar Dydo uploaded patch set 17 09/13/24, 10:14

    Copied Votes: * Verified-1 (copy condition: "**changekind:NO_CHANGE**")
  17. core-ci voted on patch set 17 V +1 09/13/24, 10:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/65656

  18. Guido Schmechel voted on patch set 17 V +1 09/13/24, 14:50

  19. Markus Klein commented on patch set 17 09/13/24, 17:30

    Isn't this a breaking change with the Interface modification? I still find that acceptable, but it should still be marked as such.
  20. Stefan Bürk commented on patch set 17 09/14/24, 23:46

    Reply

    Adding interface method is breaking, and implementing custom node implementation is a thing which is done in agencies. Marking as breaking is not enough and cannot be done outside of .0 release. Not looked into this change at all, but it could not been made non-breaking (elements not having the renderPreview method implemented) it cannot be done in v13 - and not seconds before freeze release. Using a dedicated interface only defining the `renderPreview` method may be a way, and the abstract could implement that method (if it is suitable for ALL implementations extending the abstract without breaking).Calling code should check for the interface. A fallback strategy needs to be planned - rendering a `preview for xx not possible` instead of silently not showing it ?
  21. Benni Mack commented on patch set 17 04/09/25, 18:15

    Reply Unresolved

    just FYI. As this is/was breaking - now is the time to make this patch ready and mark it as breaking
  22. Benni Mack commented on patch set 17 07/24/25, 15:40

    There is no activity in the past 10 months, will set this to WIP now
  23. Benni Mack marked it work in progress 07/24/25, 15:40

  24. Marcin Sągol uploaded patch set 18 V +1 08/06/26, 22:27

  25. core-ci voted on patch set 18 V -1 08/06/26, 22:34 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106081