Skip to content
Snippets Groups Projects
Commit 7f669848 authored by Daniel Goerz's avatar Daniel Goerz Committed by Christian Kuhn
Browse files

[BUGFIX] Show "add pages" button to qualified users only

If an editor has no rights to create new pages of any type the
icon for showing the document toolbar for the drag'n drop
adding is shown nevertheless.

This patch changes this behavior. The icon is only shown
after the AJAX call returns at least one allowed doktype.

Change-Id: I35050e4cfe923b58c26d85ce39a69dc69aa58515
Resolves: #26901
Releases: master
Reviewed-on: http://review.typo3.org/43629


Reviewed-by: default avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: default avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent a167e6c3
Branches
Tags
No related merge requests found
......@@ -125,8 +125,12 @@ class ExtdirectTreeDataProvider extends \TYPO3\CMS\Backend\Tree\AbstractExtJsTre
}
$doktypes = GeneralUtility::trimExplode(',', $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.doktypesToShowInNewPageDragArea'));
$output = array();
$allowedDoktypes = GeneralUtility::trimExplode(',', $GLOBALS['BE_USER']->groupData['pagetypes_select']);
$allowedDoktypes = GeneralUtility::trimExplode(',', $GLOBALS['BE_USER']->groupData['pagetypes_select'], TRUE);
$isAdmin = $GLOBALS['BE_USER']->isAdmin();
// Early return if backend user may not create any doktype
if (!$isAdmin && empty($allowedDoktypes)) {
return $output;
}
foreach ($doktypes as $doktype) {
if (!$isAdmin && !in_array($doktype, $allowedDoktypes)) {
continue;
......
......@@ -426,18 +426,23 @@ TYPO3.Components.PageTree.TopPanel = Ext.extend(Ext.Panel, {
});
this.dataProvider.getNodeTypes(function(response) {
for (var i = 0; i < response.length; ++i) {
response[i].template = this.getButtonTemplate();
newNodeToolbar.addItem(response[i]);
var amountOfNodeTypes = response.length;
if (amountOfNodeTypes > 0) {
topPanelButton.show();
for (var i = 0; i < amountOfNodeTypes; ++i) {
response[i].template = this.getButtonTemplate();
newNodeToolbar.addItem(response[i]);
}
newNodeToolbar.doLayout();
}
newNodeToolbar.doLayout();
}, this);
var topPanelButton = new Ext.Button({
id: this.id + '-button-newNode',
cls: this.id + '-button',
text: TYPO3.Components.PageTree.Icons.NewNode,
tooltip: TYPO3.Components.PageTree.LLL.buttonNewNode
tooltip: TYPO3.Components.PageTree.LLL.buttonNewNode,
hidden: true
});
this.addButton(topPanelButton, newNodeToolbar);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment