Project

General

Profile

Actions

Bug #91873

open

Bootstrap::initializeBackendAuthentication() documentation inconsistent

Added by S P over 4 years ago. Updated about 1 month 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:
12
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/12.4/en-us/ApiOverview/DataHandler/UsingDataHandler/Index.html#dataHandler-cli-command 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 over 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 S P over 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 over 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 S P over 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 S P about 3 years ago

  • TYPO3 Version changed from 9 to 10
Actions #6

Updated by Benni Mack over 1 year ago

  • Sprint Focus set to On Location Sprint
Actions #7

Updated by S P about 1 month ago

  • Description updated (diff)
  • TYPO3 Version changed from 10 to 12

Still inconsistent on v12.

Actions

Also available in: Atom PDF