I've added my own scheduler task to the TYPO3 that will, for example, create new page if necessary. The scheduler runs by a special _cli_scheduler
user and if I create new pages with it, other editors may not see it.
I'm using the DataHandler
(former TCE
) to create new pages. The start()
method accepts an optional parameter - alternative user object that will be used as a creator of the page.
Having uid
of an editor user, how can I fully instantiate the \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
object which then I provide to the DataHandler::start()
?
I was thinking of using the object manager to get new instance of the mentioned class and just set the uid
on it, but the DataHandler
checks some other properties of the BackendUserAuthentication
object, like permissions, etc.
What is the correct way for getting BackendUserAuthentication
object will all user data? Is there any factory or a repository I could use?
No one was able to help me with this, so I started digging. After some reverse engineering I have found a complete way for loading any backend user as long as you know their ID. I have created a read-only repository with the following method:
It will do the following:
$user
propertyUC
of the userI've dumped user created by this method and compared with the currently logged-in user and it seems that all necessary properties have been set up.
Please let me know if I missed something.