Review main Ready for review

98272[BUGFIX] Keep the backend user aspect of the request

Matthias Vogel CR +1 V +1 Normal +63 −6 updated 12/02/26, 07:22

Commit message

When fetchGroupData() runs for a user who is not the backend user of
the request, the "backend.user" aspect of the Context points to that
other user afterwards. $GLOBALS['BE_USER'] still points to the real
backend user. Code that reads the aspect, for example page TSconfig
conditions, then uses the wrong user for the rest of the request.

The cause is the change for #92516. User TSconfig conditions like
[backend.user.isAdmin] read the "backend.user" aspect. Thus,
fetchGroupData() sets the aspect to the parsed user before it parses
the user TSconfig. But it does not restore the aspect after the
parsing.

fetchGroupData() now keeps the aspect of the parsed user only while
the user TSconfig is parsed, and then restores the previous aspect.
The conditions in the user TSconfig still match the parsed user.

The command line user relied on the aspect that fetchGroupData() left
behind. CommandLineUserAuthentication::authenticate() now sets the
aspect itself, as initializeBackendLogin() does for a backend login.

Affected cases:
* Backend Users module: the show and compare views of users and the
  show view of groups load the group data of other users
* EXT:reactions: the dry run of a create-record reaction loads the
  group data of the impersonated user
Show more Show less

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

Review

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

Merge conflicts 5

Issues 2

Files 5

Review log 23

  1. Matthias Vogel uploaded patch set 1 12/02/26, 06:26

  2. core-ci voted on patch set 1 V +1 12/02/26, 06:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/116155

  3. Georg Ringer voted on patch set 1 CR +1 V +1 12/02/26, 07:22