Bug #86923

Symfony expressions/conditions doesn't work in user-tsconfig

Added by Oliver Hader over 1 year ago. Updated 24 days ago.

Status:
Accepted
Priority:
Must have
Assignee:
-
Category:
Authentication
Target version:
-
Start date:
2018-11-14
Due date:
% Done:

100%

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

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 #88841: Conditions in .tsconfig file are not read Closed 2019-07-25
Related to TYPO3 Core - Bug #90075: backend user symfony expressions not working in TSConfig Accepted 2020-01-09

Associated revisions

Revision 7ffd8cb0 (diff)
Added by Benni Mack 5 months 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 Oliver Hader over 1 year ago

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

#2 Updated by Oliver Hader over 1 year ago

  • Complexity set to medium

Since issue #86229 was reverted in #86856 the fix has to be reimplemented

  • refactor BackendUserAuthentication::fetchGroupData into distinct parts, but keep the functionality for backward compatibility
  • most interesting part is when Context aspects are defined (workspaces) and when they are used (TSconfig conditions)

#3 Updated by Stefan P about 1 year ago

  • Priority changed from Should have to Must have

Any news here? For "upgraders" this is very important to be either documented very prominently (maybe even in the deprecation notice itself) or to be fixed soon. I just spend debugging hours why the syntax is not working, just to find that it's not working in user TS config due to a change after the LTS release.

#4 Updated by Jonas Eberle 10 months ago

  • Related to Bug #88841: Conditions in .tsconfig file are not read added

#5 Updated by Andreas Fragner 7 months ago

Stefan P wrote:

Any news here? For "upgraders" this is very important to be either documented very prominently (maybe even in the deprecation notice itself) or to be fixed soon. I just spend debugging hours why the syntax is not working, just to find that it's not working in user TS config due to a change after the LTS release.

Still not working and also spent some hours of debugging just to find out that conditions are not working in user TS config. When will this be fixed?

#6 Updated by Riccardo De Contardi 5 months ago

  • Related to Bug #90075: backend user symfony expressions not working in TSConfig added

#7 Updated by Susanne Moog 5 months ago

  • Sprint Focus set to On Location Sprint

#8 Updated by Gerrit Code Review 5 months ago

  • Status changed from New to Under Review

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

#9 Updated by Gerrit Code Review 5 months 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

#10 Updated by Benni Mack 5 months ago

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

#11 Updated by Benni Mack 3 months ago

  • Status changed from Resolved to Closed

#12 Updated by Gerrit Code Review 2 months ago

  • Status changed from Closed to Under Review

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

#13 Updated by Frank Naegler 24 days ago

  • Status changed from Under Review to Accepted

already fixed in master (v10)

Also available in: Atom PDF