Bug #80426
closedCreating a FlexForm section causes exception in ajax request (none admin user)
100%
Description
I can´t add a new flexform section because the ajax request that´s being made gets a typo3 exception.
IMPORTANT:
This does not happen with a admin account.
Only a default be-user triggers this error. (In my case this be-user is not limited to any languages)
The problem is, that the $result form DatabaseUserPermissionCheck::addData is not correctly filled.
I made a quick&dirty workaround here: https://github.com/BenjaminBeck/TYPO3.CMS/commit/3fa93f055973aaf06b6d3f741a0b6c9a3df639ae
Files
Updated by Benjamin no-lastname-given over 7 years ago
- Category changed from Frontend to FormEngine aka TCEforms
Updated by Wouter Wolters over 7 years ago
- Status changed from New to Needs Feedback
Could provide us with some more information what the exact error is you get?
Is it possible to attach a test extension that can reproduce this error on current master?
Updated by Marcus Schwemer over 7 years ago
Sounds like the same what we are experiencing currently.
We have a content element where editors can add one or more items to a list via a flexform.
If editors create a new ce, they can add as many items as they want. If the save it and then try to add a new item, it results in an error 500. Looking at the console, reveils an error 500. The exception message is
No content edit permission for user 2 on page root node
This is "right", because the user does not have permission to edit on the root page. On the other hand, this is the explanation, why this does not "harm" admin users. They are allowed to edit records on uid 0.
The ajax request in both cases (new ce and saved ce) is:
http://t3trunk/typo3/index.php?ajaxID=%2Fajax%2Frecord%2Fflex%2Fcontaineradd&ajaxToken=628ecdf44b955861e2ba1b9c0ee2a98478cbfed6
I'm using the current master with php 7.0
Updated by Marcus Schwemer over 7 years ago
Here is a basic example extension, which contains an additional CE building a link list. Only the backend stuff is included ...
Updated by Markus Sommer over 7 years ago
Please see the patch https://review.typo3.org/#/c/52174/
Updated by Alex Kellner over 7 years ago
Our current workarround to get this issue done for two new content elements is to add an own FormDataProvider. Thx to Markus Sommer for the quick fix.
Maybe someone else needs this.
ext_tables.php of the template extension:
$class = \In2code\In2template\Backend\FormDataProvider\FixEditorPermissions::class; $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['formDataGroup']['tcaDatabaseRecord'][$class] = [ 'before' => [ \TYPO3\CMS\Backend\Form\FormDataProvider\ReturnUrl::class, ] ];
FixEditorPermissons.php:
<?php declare(strict_types = 1); namespace In2code\In2template\Backend\FormDataProvider; use TYPO3\CMS\Backend\Form\FormDataProviderInterface; use TYPO3\CMS\Backend\Utility\BackendUtility; /** * Resolve return Url if not set otherwise. * This fixes FlexForm with inline elements. Editors can not add new itemsets. * An error 500 is thrown in browser console that's not allowed to add new items to page with uid=0. */ class FixEditorPermissions implements FormDataProviderInterface { /** * @param array $result * @return array */ public function addData(array $result) { if ($result['tableName'] === 'tt_content') { $result['databaseRow'] = BackendUtility::getRecord($result['tableName'], $result['databaseRowUid']); } return $result; } }
Updated by Christian Kuhn over 7 years ago
I'm able to reproduce the issue with the extension and will review the proposed pending fix now.
Updated by Gerrit Code Review over 7 years ago
- Status changed from Needs Feedback to Under Review
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52174
Updated by Xavier Perseguers over 7 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset ff0b0832e2cee479f540d9287a671e178278f2f6.
Updated by Daniel Goerz over 7 years ago
- Related to Bug #80825: FlexForm Sections don't get saved before the parent record was stored to the DB added
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed