Prevent BE logout in Scheduler module #134
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In TYPO3v12 opening the Scheduler module which contains Searchable indexing tasks did lead to a BE logout.
The reason for this was the "initializeUserSessionManager()" call as performed for all indexing commands. Commands registered as Scheduler tasks are instantiated once to collect them for display in the module. Due to said session manager initialization the existing BE user session was replaced with an anonymous one, effectively resulting in a BE logout.
However, we cannot drop this call completely since it is necessary for the clipboard access in "TYPO3\CMS\Backend\Form\FormDataProvider"; this fails with a BE user without initialized session.
So for now we avoid this issue by checking for the type of the BE user. We now only initialize the user session manager for CLI; in BE/Scheduler everything is already set up.
See https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.0/Breaking-93023-ReworkedSessionHandling.html
And https://github.com/TYPO3/typo3/blob/4140e8553a2e59045afcf1d4c7287f229f547189/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaGroup.php#L97