Review 13.4 Merged

88647[TASK] Streamline DataHandler permission checks

Christian Kuhn CR +2 V +2 Expert +813 −634 updated 03/19/25, 08:28

Commit message

The DataHandler permission check related methods - mainly
those related to recordInfoWithPermissionCheck() are very
hard to call correctly and contain lots of complex details.
They are the source of many database queries when changing
records in the Backend. Earlier attempts to improve the
situation added various caches, even though caching db state
in DataHandler is not a great solution since it can easily
lead to side effects when records are changed multiple times
in one process.

The patch streamlines this area within the DataHandler
significantly: The main strategy is to move the "getting
record facts" (usually using BackendUtility::getRecord())
code up into the calling method and hand these records down
to the permission check methods so they don't need to fetch
the record in question over and over again. This aligns well
with the general strategy of having the record fetching code
in the top level "entry" methods (like moveRecord(),
deleteRecord(), ...) and handing them around. This makes
everything much more deterministic, quicker and maintainable.

The permission check methods typically look at page record
details and check for CONTENT_EDIT flag, ownerships and similar.
The calling code thus has to fetch the page row a record is
attached to. This is relatively straight, even though the code
has to deal with records on pid 0 (zero) correctly.

This refactoring drops four cache properties. The patch saves
quite a few queries. Depending on what is measured, it seems
the number of queries shrink by up to 1/3, especially with
non-admin users.

The v13 backport keeps the old public methods with their
signature as-is to not risk breaking hooks.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
  • Verified V +2 Done
    • Christian Kuhn +2
    • core-ci +1 CI

Issues 2

Files 5

Review log 46

  1. Christian Kuhn uploaded patch set 1 03/19/25, 07:58

  2. core-ci voted on patch set 1 V -1 03/19/25, 08:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75809

  3. Christian Kuhn uploaded patch set 2 V -1 03/19/25, 08:10

  4. core-ci voted on patch set 2 V +1 03/19/25, 08:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/75810

  5. Christian Kuhn voted on patch set 2 CR +2 V +2 03/19/25, 08:28

  6. Christian Kuhn merged patch set 3 03/19/25, 08:28