[BUGFIX] Fix fatal error in PermissionController 70/44070/5
authorMichael Oehlhof <typo3@oehlhof.de>
Wed, 14 Oct 2015 22:10:50 +0000 (00:10 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Thu, 15 Oct 2015 21:37:29 +0000 (23:37 +0200)
Make sure we deal with the correct view class before accessing
any members of it.

Resolves: #70728
Releases: master
Change-Id: I0cd8c2d775f7c0fd7202b314f1fc3ce3c71b58dc
Reviewed-on: http://review.typo3.org/44070
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Marcus Schwemer <ms@schwemer.de>
Tested-by: Marcus Schwemer <ms@schwemer.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/beuser/Classes/Controller/PermissionController.php

index 0414d83..e01603f 100644 (file)
@@ -116,7 +116,6 @@ class PermissionController extends ActionController
      */
     protected function initializeView(ViewInterface $view)
     {
-        /** @var BackendTemplateView $view */
         parent::initializeView($view);
         $view->assign(
             'previewUrl',
@@ -125,17 +124,21 @@ class PermissionController extends ActionController
                 BackendUtility::BEgetRootLine($this->pageInfo['uid'])
             )
         );
-        $this->view->getModuleTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Beuser/Permissions');
-        $this->view->getModuleTemplate()->addJavaScriptCode(
-            'jumpToUrl',
-            '
-            function jumpToUrl(URL) {
-                window.location.href = URL;
-                return false;
-            }
-            '
-        );
-        $this->registerDocheaderButtons();
+
+        // the view of the update action has a different view class
+        if ($view instanceof BackendTemplateView) {
+            $view->getModuleTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Beuser/Permissions');
+            $view->getModuleTemplate()->addJavaScriptCode(
+                'jumpToUrl',
+                '
+                function jumpToUrl(URL) {
+                    window.location.href = URL;
+                    return false;
+                }
+                '
+            );
+            $this->registerDocHeaderButtons();
+        }
     }
 
     /**
@@ -144,7 +147,7 @@ class PermissionController extends ActionController
      * @return void
      * @throws \InvalidArgumentException
      */
-    protected function registerDocheaderButtons()
+    protected function registerDocHeaderButtons()
     {
         /** @var ButtonBar $buttonBar */
         $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();