Review main Ready for review

92705[BUGFIX] Only offer translations of records the user may localize

Juliane Wundermann CR 0 V 0 Hard +752 −62 updated 11/12/26, 22:06

Commit message

The Page module translate button, the translation wizard and the
localization panel of the Records module offered records which
DataHandler refuses to localize afterwards, e.g. content elements
whose CType is not allowed for the user, records on pages without
"edit content" permission or with "editlock", records on page types
which do not allow the table, or translations into a language the
user has no access to.

The checks DataHandler applies before localizing a record now live in
the new internal LocalizationAccessChecker of EXT:core:

* the "edit content" permission on the page, evaluated by the checker
  from the page record (web mount, permission bits and "editlock" of
  the page) with the new internal PagePermissionChecker, which now
  holds the logic of DataHandler::hasPageContextPermission(),
* whether the table is allowed on the page, by its root level
  restriction and the record types allowed for the page type,
* BackendUserAuthentication::checkRecordEditAccess() for the
  translation as a new record in the target language, which covers
  language access and authMode fields such as CType.

As in DataHandler, "editlock" of the record in the source language
does not prevent its localization, and records on the root level are
allowed for admins, or for tables ignoring the root level restriction.

DataHandler::localizeRecord() now uses the checker instead of its own
checks, and the Page module, the translation wizard and the Records
module use it to decide what they offer, so the backend and
DataHandler can no longer disagree on what may be localized.

Table modify access stays with the caller: DataHandler keeps
checkModifyAccessList(), which hooks extend, e.g. to let editors with
file permissions localize file metadata, while the backend checks
"tables_modify" of the user.

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

Review

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

Merge conflicts 48

Issues 1

Files 13

Review log 1828

Show 23 earlier messages
  1. Juliane Wundermann uploaded patch set 1 02/06/26, 10:26

  2. Simon Schaufelberger commented on patch set 1 02/06/26, 10:35

    only checked code style

    ContentFetcher.php:189

    this empty line can be removed
  3. core-ci voted on patch set 1 V +1 02/06/26, 10:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95261

  1. Matthias Vogel voted on patch set 1 CR +1 V +1 02/06/26, 10:39

  2. Juliane Wundermann uploaded patch set 2 CR +1 V +1 02/06/26, 10:42

  3. Juliane Wundermann commented on patch set 2 02/06/26, 10:43

    ContentFetcher.php:189 Reply

    Done
  4. core-ci voted on patch set 2 V +1 02/06/26, 10:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95264

  5. Matthias Vogel voted on patch set 2 CR +1 V +1 02/06/26, 12:34

  6. Marno Schmigotzki voted on patch set 2 CR +1 V +1 02/06/26, 13:05

  7. Oli Bartsch uploaded patch set 3 CR +1 V +1 02/06/26, 13:10

  8. Oli Bartsch commented on patch set 3 V -1 02/06/26, 13:19

    BackendLayoutView.php:278

    This at least misses proper page permissions. We should try to centralize this to be sure we cover all necessary configuration options.
  9. Matthias Vogel voted on patch set 3 CR +1 V +1 02/06/26, 13:19

  10. core-ci voted on patch set 3 V -1 02/06/26, 14:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95291

  11. core-ci voted on patch set 3 V +1 02/06/26, 14:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95291

  12. Benni Mack updated the commit message in patch set 4 CR +1 V +1 04/22/26, 07:15

  13. core-ci voted on patch set 4 V -1 04/22/26, 11:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100851

  14. Benni Mack uploaded patch set 5 V -1 11/11/26, 10:44

  15. core-ci voted on patch set 5 V +1 11/11/26, 10:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114056

  16. Benni Mack uploaded patch set 6 V +1 11/11/26, 14:14

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

  18. Benni Mack commented on patch set 6 11/11/26, 15:18

    BackendLayoutView.php:278 Reply

    Done
  19. Benni Mack uploaded patch set 7 V -1 11/12/26, 19:00

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

  21. Benni Mack uploaded patch set 8 V +1 11/12/26, 20:04

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

  23. Oli Bartsch commented on patch set 8 11/12/26, 21:22

    BackendLayoutView.php:278 Reply Unresolved

    IMO the page permission part is not resolved yet. The checker just uses a Permission passed in by the caller. Please check my comment in the file.

    DataHandler.php:4975 Unresolved

    result of `hasPageContextPermission()` is mapped to `CONTENT_EDIT` / `NOTHING` just to fit the checker signature, so the bitmask doesn't reflect what was actually checked. This should go away once the checker computes the page permission itself.

    LocalizationAccessChecker.php:94 Unresolved

    We trust the passed `Permission`, while callers compute it differently. `DataHandler` uses `hasPageContextPermission()`, which has `pages.editlock`. `ContentFetcher`, `LocalizationController` and `DatabaseRecordList` use `calcPerms()`, which ignores it. With `editlock=1` and `CONTENT_EDIT` granted, the translate button, wizard list and Records panel still offer records, but `DataHandler` then refuses with "Missing permission to edit content". Please let the checker work out the page permission itself from the page row (webmount, perms bits, editlock), for example by moving the `hasPageContextPermission()` logic into a core service. Callers would then pass the page row, plus the required permission for the `sys_file_reference`/`PAGE_EDIT` case.
  24. Benni Mack uploaded patch set 9 V +1 11/12/26, 21:59

  25. core-ci voted on patch set 9 V +1 11/12/26, 22:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114250