Skip to content
Snippets Groups Projects
Commit 7ffd8cb0 authored by Benni Mack's avatar Benni Mack
Browse files

[BUGFIX] Re-enable conditions within UserTSconfig

The backend user aspect must be set before BE_USER->fetchGroups is called
and the TypoScript parser needs a proper ConditionMatcher object for the Symfony-based UserTSconfig conditions like [backend.user.isAdmin] to be
working.

Note to future self:
The reason why the original change was reverted was that:
- before workspace-related conditions did not work.
- then workspaces worked, but conditions in userTSconfig bricked partially
- the patch was reverted and left for dead for 1 year as it's a chicken-egg problem

The main issue is that fetchGroup() is doing too much.
- A valid user record exists, but the right workspace haven't been "set" which
  always returns workspace=0 for workspace-related conditions
- So the workspace must be initialized earlier, and not at the end of the fetchGroups()
  call.
- workspaceInit() - and some other code within fetchGroups() relies on finished TSconfig (that is the actual chicken-egg problem)

So we'll just set the aspects before, but BEFORE setting the aspects,
we'll evaluate the selected workspace of a user in a "plain" way.

The reason why the backend context aspect now works (again) is because the
context contains a "real" BE user object and fetches the data from the object,
where as the workspace aspect just contains a static property.

Resolves: #90075
Resolves: #86923
Related: #86229
Reverts: #86856
Releases: master, 9.5
Change-Id: I326d92a860a806ff13748cf13ef6b71b7a77089e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62887


Reviewed-by: default avatarSusanne Moog <look@susi.dev>
Reviewed-by: default avatarHenning Liebe <h.liebe@neusta.de>
Reviewed-by: default avatarSascha Rademacher <sascha.rademacher+typo3@gmail.com>
Reviewed-by: default avatarFrank Nägler <frank.naegler@typo3.org>
Reviewed-by: default avatarFelix P. <f.pachowsky@neusta.de>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarSusanne Moog <look@susi.dev>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarFrank Nägler <frank.naegler@typo3.org>
Tested-by: default avatarBenni Mack <benni@typo3.org>
parent 41fc71db
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment