[BUGFIX] Fix hook prohibiting record editing in the BE 30/24830/2
authorStefan Rotsch <stefan.rotsch@aoemedia.de>
Wed, 16 Oct 2013 08:54:58 +0000 (10:54 +0200)
committerStefan Rotsch <stefan.rotsch@aoemedia.de>
Wed, 16 Oct 2013 09:21:11 +0000 (11:21 +0200)
Change-Id: If3734a8c6855740d729930f6b34265dee44a0325
Reviewed-on: https://review.typo3.org/24830
Reviewed-by: Stefan Rotsch
Tested-by: Stefan Rotsch
hooks/class.tx_languagevisibility_hooks_alt_doc.php

index 7038fd3..860cfd7 100644 (file)
 class tx_languagevisibility_hooks_alt_doc {
 
        /**
-        * @param $params
-        * @param $ref
+        * @param array $params
+        * @param SC_alt_doc $ref
         * @return bool
         */
-       public function makeEditForm_accessCheck($params, &$ref) {
-               if ( $params['hasAccess']) {
-                       return FALSE;
+       public function makeEditForm_accessCheck(array $params, SC_alt_doc &$ref) {
+               if ($params['hasAccess']) {
+                       return TRUE;
                }
-               $hasAccess = TRUE;
-                       // if user wants to edit/create page record but has no access to default language!
-               if ($params['table'] == 'pages' && ! $GLOBALS['BE_USER']->checkLanguageAccess(0)) {
-                       $visibilityservice = t3lib_div::makeInstance('tx_languagevisibility_beservices');
-                       if (! $visibilityservice->hasUserAccessToPageRecord($params['uid'], $params['cmd'])) {
-                               $hasAccess = FALSE;
+
+                       // user wants to edit/create page record but has no access to default language
+               $hasAccess = FALSE;
+               if ($params['table'] === 'pages' && !$GLOBALS['BE_USER']->checkLanguageAccess(0)) {
+                       $visibilityService = t3lib_div::makeInstance('tx_languagevisibility_beservices'); /** @var tx_languagevisibility_beservices $visibilityService */
+                       if ($visibilityService->hasUserAccessToPageRecord((int) $params['uid'], $params['cmd'])) {
+                               $hasAccess = TRUE;
                        }
                }
                return $hasAccess;