Project

General

Profile

Actions

Feature #85312

closed

self defined BE_USER not possible in DataMapProcessor

Added by Franz Holzinger over 6 years ago. Updated over 6 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
Start date:
2018-06-19
Due date:
% Done:

0%

Estimated time:
PHP Version:
7.0
Tags:
Complexity:
Sprint Focus:

Description

In TYPO3 6.2 and 7.6 I have used a self defined BE_USER object to use it with the DataHandler.

/** @var \TYPO3\CMS\Core\DataHandling\DataHandler $tce */
$tce = GeneralUtility::makeInstance('TYPO3\CMS\Core\DataHandling\DataHandler'); // create TCE instance
$tce->start($data, array(), $backendUser);
$tce->process_datamap();

This did work fine.
This feature is broken in typo3_src-8.7.15.

It raises an exception:

Argument 2 passed to TYPO3\CMS\Core\DataHandling\Localization\DataMapProcessor::instance() must be an  instance of TYPO3\CMS\Core\Authentication\BackendUserAuthentication, instance of JambageCom\TtProducts\Backend\BackendUserSimulation given, called in /srv/www/myuser/pabstneuhtdocs/typo3_src-8.7.15/typo3/sysext/core/Classes/DataHandling/DataHandler.php on line 986
TypeError thrown in file
/srv/www/myuser/myuserneuhtdocs/typo3_src-8.7.15/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php in line 86
typo3_src-8.7.15/typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php causes a compatibility break.
function instance requires a BackendUserAuthentication class and not a AbstractUserAuthentication as it should be. I see no reason why this is done.
This breaks the feature in file /home/franz/Downloads/TYPO3/typo3_src-8.7.15/typo3/sysext/core/Classes/DataHandling/DataHandler.php line 986:
$this->datamap = DataMapProcessor::instance($this->datamap, $this->BE_USER)->process();* @param BackendUserAuthentication|null $altUserObject An alternative userobject you can set instead of the default, which is $GLOBALS['BE_USER']
*/
public function start($data, $cmd, $altUserObject = null)

There is no such requirement in the start method. $this->BE_USER can be of any class and should only derive from AbstractUserAuthentication .
I think this is a unwanted incompatibility which breaks the feature to have an alternative BE_USER object..


Files

patch-85312.diff (1.9 KB) patch-85312.diff Franz Holzinger, 2018-06-20 11:23
Actions #1

Updated by Franz Holzinger over 6 years ago

This patch fixes this issue.

Actions #2

Updated by Wouter Wolters over 6 years ago

  • Status changed from New to Rejected

Hi Frans, as you can see in the PHPdoc of the function start this was always a BackendUserAuthentication object. See https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_7-6/typo3/sysext/core/Classes/DataHandling/DataHandler.php#L741

Now with the new introduced DataMapProcessor we enfore that this object needs to be an BackendUserAuthentication.
Please cereate an BackendUserAuthentication your self for your usecase or explain why that can't be done.

For now I reject this issue.

Thanks.

Actions #3

Updated by Franz Holzinger over 6 years ago

Hello Wouter, I cannot use a BackendUserAuthentication object in my case because this would not make any sense to have so many attributes and methods which are not needed because this object is not intended to be used in the backend. I am simulating a backend user in order to be able to use the DataHandling in the front end. And this did work very fine as long as BackendUserAuthentication has not been enforced. I really need an abstract base class from which I can derive the extension backend user simulation class.
This is only needed because TYPO3 does not support DataHandling in the front end.

I have had an issue with a feature request to support DataHandling in the front end. As far as I remember this had been rejected as not necessary. But I want to add references to images which are connected to the FAL. And there are so many things which need be correctly inserted into different FAL reference tables. So I want to go this way in the front end and use the DataHandling which accomplishes many things automatically for my purpose.

Actions

Also available in: Atom PDF