Review main Merged

77638[TASK] Avoid backend.user request attribute

Christian Kuhn CR +2 V +2 Easy +16 −23 updated 02/01/23, 17:49

Commit message

The user authentication classes are still pretty messy.
A subset of properties and information of backend user
state is intitialized by middlewares and set as aspect
to the context object.

However, we do not want to add the entire backend user
as $request attribute object, to not surface another usage
of this object. Instead, it is set as $GLOBALS['BE_USER']
throughout the core, which will eventually vanish at
some point, by being substituted by something better.

ext:reactions currently violates this. The patch sets
$GLOBALS['BE_USER'], consuming reactions should retrieve
it from there if needed, just like any other backend
related class does it currently.

FormProtectionFactory had a similar flaw, it accessed
the attribute even though no middleware ever set this.

Finally, .phpstorm.meta.php is cleaned up, to not
declare this request attribute any longer.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • Benni Mack +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 6

Review log 1012

  1. Christian Kuhn uploaded patch set 1 01/30/23, 14:33

  2. Christian Kuhn updated the commit message in patch set 2 01/30/23, 14:33

  3. Christian Kuhn updated the commit message in patch set 3 01/30/23, 14:35

  4. core-ci voted on patch set 3 V -1 01/30/23, 14:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36772

  5. Benjamin Franzke commented on patch set 3 CR -2 01/30/23, 16:23

    This is a breaking change. What's the issue at all? It's just a reference, but a better one than $GLOBALS. Feel free to refactor BackendUser to optimize it. The backend user information is really a attribute of the request (very important for subrequests). Please do not remove it without a real substitude.
  6. Christian Kuhn commented on patch set 3 01/30/23, 16:43

    Reply

    Well, I had this discussion with Benni as well: I wanted to add the BackendUserAuthentication object as backen.user attribute to request already, but Benni never wanted to have this. Instead, he wants to get the context aspect elevated to carry needed information, which is always available and does not depend on request scope. I understand and support this reasoning. As such, ext:reactions is the first one that introduced this. I agree with Benni this should be avoided. The reactions feature came with 12.1, so Benni said its not heavily breaking when we adapt details of the implementation with 12.2. I share this view.
  7. Benjamin Franzke commented on patch set 3 CR 0 01/30/23, 18:45

    Reply

    Sorry, i totally confused backend.user/frontend.user with the frontend.controller attribute (don't know how). Then better remove it now, as long as it not fully integrated in all placed 👍 Thanks for the clarification.
  8. core-ci voted on patch set 3 V +1 01/31/23, 10:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/36772

  9. Benni Mack voted on patch set 3 V +1 CR +1 02/01/23, 15:41

  10. Stefan Bürk voted on patch set 3 V +1 CR +1 02/01/23, 17:07

  11. Christian Kuhn voted on patch set 3 V +2 CR +2 02/01/23, 17:49

  12. Christian Kuhn merged patch set 4 02/01/23, 17:49