#111703User TSconfig conditions on the workspace never match in the backend
Description
Summary
On main, user TSconfig conditions on the workspace do not work in the backend. A condition such as [workspace.isOffline] never matches, and [workspace.isLive] always matches, also for a backend user who works in a workspace. TYPO3 v14.3 is not affected.
Impact
Integrators use workspace conditions in user TSconfig to give editors a different backend in a workspace than in live. Examples: hide or show options, change the defaults of the Page module, allow other actions in a draft workspace. On main, all editors get the live configuration in each workspace. Nothing tells the editor or the integrator that the condition did not match.
All backend requests with a session and each login are affected.
Steps to reproduce
- Install EXT:workspaces and create a custom workspace, for example with the uid 1.
- Add this user TSconfig to a backend user:
[workspace.isOffline] options.pageTree.showPageIdWithTitle = 1 [end]
- Log in as this user and switch to the workspace.
- Look at the page tree.
Expected: In the workspace, the page tree shows the page IDs next to the titles.
Actual: The page tree shows no page IDs. The condition sees the live workspace. The same occurs directly after the login.
Cause
Since #110972 (adc640d8730, “Authenticate users via the auth pipeline”), the authenticators of the backend (SessionAuthenticator, PasswordAuthenticator, LegacyBackendAuthenticator) call BackendUserAuthentication::fetchGroupData() during the authentication. fetchGroupData() also parses the user TSconfig at this point.
The conditions of the user TSconfig read the workspace from the global Context (IncludeTreeConditionMatcherVisitor). At this time, the workspace aspect still contains the live workspace. The middleware BackendUserAuthenticator sets the workspace of the backend user only after the authentication. Later, initializeBackendLogin() does not parse the TSconfig again, because the group data is already fetched.
Before #110972, the middleware set the workspace aspect before it fetched the group data, so the conditions saw the correct workspace.
Related problem
The conditions on the backend user (for example [backend.user.isAdmin]) have the same order problem. #92516 solved this with a line in fetchGroupData() that writes the backend.user aspect of the global Context. This line also runs when code fetches the group data of another user, for example the module “Backend Users” or the dry run of a reaction. Then the aspect of the current user is overwritten for the rest of the request. #111699 handles this part.
Possible solutions
- Parse the user TSconfig against a local copy of the
Contextthat contains the workspace (and the backend user) of the parsed user. The globalContextstays unchanged. This also works when the TSconfig of another user is parsed. - Set the workspace aspect before the authenticators fetch the group data. This writes the global
Contextduring the authentication and does not work for the TSconfig of another user.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Fix this issue
Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch
- Commit message
-
[BUGFIX] User TSconfig conditions on the workspace never match in the backend Resolves: #111703 Releases: main
Related issues 3
History 3
-
Matthias Vogel changed Related to #110972 12/02/26, 09:54
-
Matthias Vogel changed Related to #92516 12/02/26, 09:54
-
Matthias Vogel changed Related to #111699 12/02/26, 09:54