[BUGFIX] Hide shortcuts to inaccessible modules for admins as well 02/44802/4
authorPatrick Schriner <patrick.schriner@diemedialen.de>
Thu, 19 Nov 2015 16:21:34 +0000 (17:21 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Sat, 21 Nov 2015 16:12:20 +0000 (17:12 +0100)
Currently the check whether a module is accessible is only done for
non-admins. Clicking on a shortcut that leads to an inaccessible module leads
to an error. Move the check outside so that those shortcuts are at least
not shown after a backend reload.

Change-Id: I0bfcb50913bc4a45ad8442221dc45649f75cf554
Resolves: #71700
Releases: master
Reviewed-on: https://review.typo3.org/44802
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php

index eeb7baf..f7020ac 100644 (file)
@@ -275,12 +275,12 @@ class ShortcutToolbarItem implements ToolbarItemInterface
             }
             // Check for module access
             $moduleName = $row['M_module_name'] ?: $row['module_name'];
+            if (!isset($this->getLanguageService()->moduleLabels['tabs_images'][$moduleName . '_tab'])) {
+                // Nice hack to check if the user has access to this module
+                // - otherwise the translation label would not have been loaded :-)
+                continue;
+            }
             if (!$backendUser->isAdmin()) {
-                if (!isset($this->getLanguageService()->moduleLabels['tabs_images'][$moduleName . '_tab'])) {
-                    // Nice hack to check if the user has access to this module
-                    // - otherwise the translation label would not have been loaded :-)
-                    continue;
-                }
                 $pageId = $this->getLinkedPageId($row['url']);
                 if (MathUtility::canBeInterpretedAsInteger($pageId)) {
                     // Check for webmount access