Bug #90075

backend user symfony expressions not working in TSConfig

Added by Ingo Fabbri 16 days ago. Updated 8 days ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2020-01-09
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
7.3
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:
On Location Sprint

Description

Symfony expressions regarding "backend.user" do not work in tsconfig.

legacy conditions work

[adminUser = 1]
options.pageTree.showPageIdWithTitle = 1
[end]

symfony expressions do not work

[backend.user.isAdmin]
options.pageTree.showPageIdWithTitle = 1
[end]

This was already fixed - but caused a regression.


Related issues

Related to TYPO3 Core - Bug #86229: Symfony expressions/conditions doesn't work in user-tsconfig Closed 2018-09-11
Related to TYPO3 Core - Bug #86856: Workspace Context API is set wrong in BE Closed 2018-11-05
Related to TYPO3 Core - Bug #86923: Symfony expressions/conditions doesn't work in user-tsconfig Resolved 2018-11-14

Associated revisions

Revision 7ffd8cb0 (diff)
Added by Benni Mack 8 days ago

[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: Susanne Moog <>
Reviewed-by: Henning Liebe <>
Reviewed-by: Sascha Rademacher <>
Reviewed-by: Frank Nägler <>
Reviewed-by: Felix P. <>
Reviewed-by: Benni Mack <>
Tested-by: Susanne Moog <>
Tested-by: TYPO3com <>
Tested-by: Frank Nägler <>
Tested-by: Benni Mack <>

History

#1 Updated by Ingo Fabbri 16 days ago

  • Related to Bug #86229: Symfony expressions/conditions doesn't work in user-tsconfig added

#2 Updated by Ingo Fabbri 16 days ago

  • Related to Bug #86856: Workspace Context API is set wrong in BE added

#3 Updated by Riccardo De Contardi 16 days ago

  • Related to Bug #86923: Symfony expressions/conditions doesn't work in user-tsconfig added

#4 Updated by Susanne Moog 13 days ago

  • Sprint Focus set to On Location Sprint

#5 Updated by Gerrit Code Review 10 days ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62887

#6 Updated by Gerrit Code Review 10 days ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62887

#7 Updated by Gerrit Code Review 9 days ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62887

#8 Updated by Benni Mack 8 days ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF