Review main Merged

90682[BUGFIX] Use DataHandler for auto redirect creation

Oli Bartsch CR +2 V +2 Normal +134 −33 updated 03/10/26, 10:57

Commit message

Use DataHandler API to create redirects after slug changes.
This ensures proper logging and history as well as general
TCA functionality such as TCAdefaults.

Since automatic redirect generation is a system-level
action that may occur regardless of user permissions,
table modification access rights are temporarily simulated
for the current user context to bypass potential access
restrictions during the operation.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Bastien Lutz +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Bastien Lutz +1
    • Oliver Hader +1
    • core-ci +1 CI

Issues 2

Files 5

Review log 3956

Show 2031 earlier messages
  1. Oli Bartsch uploaded patch set 1 09/14/25, 17:50

  2. core-ci voted on patch set 1 V +1 09/14/25, 17:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84962

  3. Georg Ringer voted on patch set 1 CR +1 V +1 09/15/25, 06:42

  4. Oli Bartsch commented on patch set 1 CR -2 09/15/25, 07:05

    Redirect reverting for non admins does not work. Have to investigate.
  5. Oli Bartsch uploaded patch set 2 CR +1 V +1 09/16/25, 09:03

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  6. core-ci voted on patch set 2 V +1 09/16/25, 09:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85013

  7. Mathias Brodala commented on patch set 2 09/16/25, 09:10

    SlugService.php:154

    These three can be dropped, as these are the defaults.
  8. Oli Bartsch uploaded patch set 3 V +1 11/27/25, 09:53

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  9. core-ci voted on patch set 3 V -1 11/27/25, 10:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/91080

  10. Stefan Bürk commented on patch set 3 11/27/25, 11:03

    SlugService.php:154 Reply

    I disagree here. The redirect composed here is definitly not a regexp redirect and does not respect query parameters, using configured TCA defaults (which can be changed) would use the defaults ending in creating a broken redirect. Setting here describes the redirect which should be created. For custom redirect creation the `ModifyAutoCreateRedirectRecordBeforePersistingEvent` can be used to adopt the settings to the kind of redirect which should be created. Using TCA defaults here are risky epxecting to compose a redirect but only ensure half of the settings for the type of redirect to create.
  11. Mathias Brodala commented on patch set 3 11/28/25, 06:48

    SlugService.php:154 Reply

    Acknowledged
  12. Bastien Lutz uploaded patch set 4 V -1 02/03/26, 11:49

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  13. core-ci voted on patch set 4 V -1 02/03/26, 12:02 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94898

  14. Bastien Lutz uploaded patch set 5 V -1 02/03/26, 13:02

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  15. core-ci voted on patch set 5 V -1 02/03/26, 13:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94901

  16. Bastien Lutz uploaded patch set 6 V -1 02/03/26, 13:46

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  17. core-ci voted on patch set 6 V -1 02/03/26, 14:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94909

  18. Bastien Lutz uploaded patch set 7 V -1 02/03/26, 14:57

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  19. core-ci voted on patch set 7 V +1 02/03/26, 15:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94920

  20. Simon Schaufelberger commented on patch set 7 CR -1 02/03/26, 15:43

    CommandLineUserAuthentication.php:95

    I prefer the not operator here as comparison with false is strange.

    SystemUserAuthentication.php:32

    remove annotation and add type string here.

    SystemUserAuthentication.php:36

    useless comment

    SystemUserAuthentication.php:59

    remove useless annotation

    SystemUserAuthentication.php:67

    remove useless comment

    SystemUserAuthentication.php:94

    remove useless comment

    SystemUserAuthentication.php:95

    use ! operator instead

    SystemUserAuthentication.php:106

    remove useless comment

    SystemUserAuthentication.php:112

    remove useless comment

    SystemUserAuthentication.php:123

    remove useless comment and add return bool to the method

    SystemUserTrait.php:32

    remove useless comment

    SystemUserTrait.php:58

    this is not the TYPO3 code style. don't align the lines

    SystemUserTrait.php:70

    remove useless comment

    SystemUserTrait.php:76

    add an empty line before
  21. Bastien Lutz uploaded patch set 8 CR -1 V +1 02/03/26, 16:10

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  22. Bastien Lutz uploaded patch set 9 02/03/26, 16:11

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  23. core-ci voted on patch set 8 V -1 02/03/26, 16:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94928

  24. core-ci voted on patch set 9 V -1 02/03/26, 16:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/94929

  25. Oliver Hader commented on patch set 9 CR -1 02/03/26, 16:59

    SystemUserAuthentication.php:24

    I understand the necessity of having an actor that has "system capabilities" (thus, basically allowed to modify anything, since the action has been started by the system). However, I'd not opt for extending the existing `*UserAuthentication` scope here, since session data, passwords etc. are most probably not required here. Unfortunately there are still hard requirements in `DataHandler` to have an instance of this object, having a user-id (basically for logging purposed) and similar constraints. Thus, for the time being (due to the lack of alternatives), I'd recommend to make this new class `final` and `@internal`. There's only an unfinished idea of introducing a `Principal` (a generic "user" with generic permissions) at https://review.typo3.org/c/Packages/TYPO3.CMS/+/92214/2/typo3/sysext/core/Classes/Security/PermissionSet/Principal.php
  26. Oliver Hader commented on patch set 9 02/03/26, 17:10

    In an way, I think addressing the redirects issue and introducing a new system-user role should be handled in two different patches.
  27. Oliver Hader commented on patch set 9 02/04/26, 10:13

    Reply

    Update as discussed during the code sprint in Rosenheim: Instead of using a new system-user or using the `admin` flag of the existing `BE_USER`, the table-modify permissions of the current user shall be adjusted temporarily for the `sys_redirects` table.
  28. Bastien Lutz uploaded patch set 10 CR -1 V -1 02/04/26, 11:17

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  29. core-ci voted on patch set 10 V +1 02/04/26, 11:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95011

  30. Bastien Lutz uploaded patch set 11 V +1 02/04/26, 15:21

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  31. core-ci voted on patch set 11 V -1 02/04/26, 16:11 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95056

  1. Oliver Hader commented on patch set 11 02/05/26, 09:38

    SlugService.php:77

    Just concerning wording, I'd use something like `TemporaryPermissionMutationService` (avoiding "fake")

    SlugService.php:178

    Error handling would be nice here: * what if `$record['uid'] === null` (persistence in datahander did not work) * checking `$dataHandler->errorLog` * add a new log entry in case something went wrong
  2. Bastien Lutz uploaded patch set 12 V -1 02/05/26, 10:05

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  3. core-ci voted on patch set 12 V +1 02/05/26, 10:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95124

  4. Bastien Lutz uploaded patch set 13 V +1 02/05/26, 10:57

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  5. core-ci voted on patch set 13 V -1 02/05/26, 11:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95130

  6. Bastien Lutz uploaded patch set 14 V -1 02/05/26, 11:48

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  7. core-ci voted on patch set 14 V +1 02/05/26, 11:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95139

  8. Oli Bartsch commented on patch set 14 CR -2 02/05/26, 12:29

    TemporaryPermissionMutationService.php:24

    Please work on arrays
  9. Bastien Lutz uploaded patch set 15 V +1 02/05/26, 13:01

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  10. core-ci voted on patch set 15 V +1 02/05/26, 13:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95146

  11. Oli Bartsch uploaded patch set 16 V +1 02/05/26, 15:39

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  12. Oli Bartsch commented on patch set 16 CR +1 V +1 02/05/26, 15:40

    SlugService.php:77 Reply

    Done
  13. Oli Bartsch commented on patch set 16 02/05/26, 15:40

    Reply

    Done

    CommandLineUserAuthentication.php:95 Reply

    Done

    SystemUserAuthentication.php:24 Reply

    Done

    SystemUserAuthentication.php:32 Reply

    Done

    SystemUserAuthentication.php:36 Reply

    Done

    SystemUserAuthentication.php:59 Reply

    Done

    SystemUserAuthentication.php:67 Reply

    Done

    SystemUserAuthentication.php:94 Reply

    Done

    SystemUserAuthentication.php:95 Reply

    Done

    SystemUserAuthentication.php:106 Reply

    Done

    SystemUserAuthentication.php:112 Reply

    Done

    SystemUserAuthentication.php:123 Reply

    Done

    SystemUserTrait.php:32 Reply

    Done

    SystemUserTrait.php:58 Reply

    Done

    SystemUserTrait.php:70 Reply

    Done

    SystemUserTrait.php:76 Reply

    Done

    SlugService.php:178 Reply

    Done

    TemporaryPermissionMutationService.php:24 Reply

    Done
  14. Bastien Lutz commented on patch set 16 CR +1 02/05/26, 15:41

    Reply

    Done

    CommandLineUserAuthentication.php:95 Reply

    Done

    SystemUserAuthentication.php:24 Reply

    Done

    SystemUserAuthentication.php:32 Reply

    Done

    SystemUserAuthentication.php:36 Reply

    Done

    SystemUserAuthentication.php:59 Reply

    Done

    SystemUserAuthentication.php:67 Reply

    Done

    SystemUserAuthentication.php:94 Reply

    Done

    SystemUserAuthentication.php:95 Reply

    Done

    SystemUserAuthentication.php:106 Reply

    Done

    SystemUserAuthentication.php:112 Reply

    Done

    SystemUserAuthentication.php:123 Reply

    Done

    SystemUserTrait.php:32 Reply

    Done

    SystemUserTrait.php:58 Reply

    Done

    SystemUserTrait.php:70 Reply

    Done

    SystemUserTrait.php:76 Reply

    Done

    SlugService.php:77 Reply

    Done

    SlugService.php:178 Reply

    Done

    TemporaryPermissionMutationService.php:24 Reply

    Done
  15. Bastien Lutz voted on patch set 16 V +1 02/05/26, 15:42

  16. core-ci voted on patch set 16 V +1 02/05/26, 15:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95176

  17. Oliver Hader commented on patch set 16 02/05/26, 15:53

    On it..
  18. Oliver Hader uploaded patch set 17 CR +1 V +1 02/05/26, 16:17

  19. Oliver Hader voted on patch set 17 CR +1 V +1 02/05/26, 16:17

  20. Oliver Hader commented on patch set 17 02/05/26, 16:17

    Reply

    Done
  21. Bastien Lutz voted on patch set 17 CR +1 V +1 02/05/26, 16:22

  22. core-ci voted on patch set 17 V +1 02/05/26, 16:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/95181

  23. Oli Bartsch voted on patch set 17 CR +2 V +2 02/05/26, 16:30

  24. Oli Bartsch merged patch set 18 02/05/26, 16:30

  25. Sybille Peters commented on patch set 18 03/10/26, 10:57

    Unresolved

    Hi, I think this patch might have caused problems with permissions because via DataHandler more permissions are checked for current user, see https://forge.typo3.org/issues/109199 Can you take a look? Thanks. Specifically, in DataHandler::hasPagePermission is called with the site root and this returns false if site root page is not in web mount: if (!$pagesSchema->hasCapability(TcaSchemaCapability::RestrictionWebMount) && !$this->BE_USER->isInWebMount($page, '', $useDeleteClause)) { return false; }