Project

General

Profile

Actions

Bug #91873

open

Bootstrap::initializeBackendAuthentication() documentation inconsistent

Added by Stefan P almost 4 years ago. Updated 12 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2020-07-27
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
On Location Sprint

Description

This method is marked with:

@internal This is not a public API method, do not use in own extensions

However, the changelog https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.4/Deprecation-85977-ExtbaseCommandControllersAndCliAnnotation.html?highlight=initializebackendauthentication say this:

If anything related to DataHandler and Backend permission handling is necessary, you should run Bootstrap::initializeBackendAuthentication();

and the docs https://docs.typo3.org/m/typo3/reference-coreapi/9.5/en-us/ApiOverview/CommandControllers/Index.html#initialize-backend-user say this:

If anything related to DataHandler and backend permission handling is necessary, you should call this initialization method once in your execute() function:

Bootstrap::initializeBackendAuthentication();

I'm confused, what is correct here? Is it safe/needed/obsolete to call this methode or not?

Actions #1

Updated by Anonymous almost 4 years ago

Better not use "Bootstrap::initializeBackendAuthentication();". IMHO it is buggy. There is a workspace-autopublish symfony command, which calls this method before doing the datahandler stuff. Where the same DataHandler call in BE-context works like a charm, the same DataHandler instructions completely do some weird bogus buggy stuff and leaves the whole system in an inconsistent state. Seems like the emulation of "backend context" is not quite complete. So better not use this pseudo initialization of the backend-user.

Actions #2

Updated by Stefan P almost 4 years ago

I don't know about buggy-ness, all I saw was that docs in web and docs in core are mismatching ("use it" vs. "don't use it"). Which could indeed be a hint that this whole thing is buggy as well. ;)

Actions #3

Updated by Sybille Peters almost 4 years ago

Unfortunately, I don't know either what is the "right" way to do this and what the decision would be.

The core itself - in the upgrade wizard typo3/sysext/install/Classes/Command/UpgradeWizardListCommand.php

uses:

use TYPO3\CMS\Core\Core\Bootstrap;

..

Bootstrap::initializeBackendUser(CommandLineUserAuthentication::class);
Bootstrap::initializeBackendAuthentication();

I have used upgrade wizards from the command line quite often and I assume others have too. No problem so far.

Better not use "Bootstrap::initializeBackendAuthentication();". IMHO it is buggy. There is a workspace-autopublish symfony command, which calls this method before doing the datahandler stuff. Where the same DataHandler call in BE-context works like a charm, the same DataHandler instructions completely do some weird bogus buggy stuff and leaves the whole system in an inconsistent state. Seems like the emulation of "backend context" is not quite complete

So, you are saying the core is currently buggy, if you call the command? Is this in typo3/sysext/workspaces/Classes/Command/AutoPublishCommand.php? Is there a bug report for that - because in that case I think that should get fixed.

Actions #4

Updated by Stefan P almost 4 years ago

The first step for some core developer (whoever wrote this method - I don't know, but wheover was it, must know something about this ;) ) should be to decide whether this method is public API or not. Streamline code doc comments and web docs. Whatever the outcome of this is, must then provide clean instructions on what or what not to do for extension authors (that may do DataHandler-related stuff in CLI context - which is quite common, just think of data import scripts from CSV or foreign Databases that run regularly).

Actions #5

Updated by Stefan P almost 3 years ago

  • TYPO3 Version changed from 9 to 10
Actions #6

Updated by Benni Mack 12 months ago

  • Sprint Focus set to On Location Sprint
Actions

Also available in: Atom PDF