[BUGFIX] Allow adding content without page edit permissions in record list 07/60907/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Sun, 9 Jun 2019 13:31:47 +0000 (15:31 +0200)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Sun, 9 Jun 2019 19:55:23 +0000 (21:55 +0200)
If a backend usergroup has no permission to edit page properties, the
wizard for content element creation is not rendered properly. This is due
to a missing import of the `PageActions` module.

This patch now always loads the module and makes its callback depending
on proper permissions.

Resolves: #88532
Related: #87687
Releases: master, 9.5
Change-Id: Ie3acaf8fbf9bdeee425eae4b4d35cb2eb80b4d1d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60907
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
typo3/sysext/recordlist/Classes/Controller/RecordListController.php

index 01f1185..ce9968a 100644 (file)
@@ -277,11 +277,13 @@ class RecordListController
         $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/AjaxDataHandler');
         $calcPerms = $backendUser->calcPerms($this->pageinfo);
         $userCanEditPage = $calcPerms & Permission::PAGE_EDIT && !empty($this->id) && ($backendUser->isAdmin() || (int)$this->pageinfo['editlock'] === 0);
+        $pageActionsCallback = '';
         if ($userCanEditPage) {
-            $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/PageActions', 'function(PageActions) {
+            $pageActionsCallback = 'function(PageActions) {
                 PageActions.setPageId(' . (int)$this->id . ');
-            }');
+            }';
         }
+        $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/PageActions', $pageActionsCallback);
         $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Recordlist/Tooltip');
         // Apply predefined values for hidden checkboxes
         // Set predefined value for DisplayBigControlPanel: