[BUGFIX] Backend user without accordant language permissions can see workspace changes
authorMichael Klapper <development@morphodo.com>
Wed, 27 Jul 2011 10:43:16 +0000 (12:43 +0200)
committerOliver Hader <oliver@typo3.org>
Wed, 27 Jul 2011 10:46:54 +0000 (12:46 +0200)
Change-Id: I953c656c4e3ea5284863c5fe4c4ebdbd1ce18725
Resolves: #27414

typo3/sysext/workspaces/Classes/Service/Workspaces.php

index c6d0faa..f1f1dbe 100644 (file)
@@ -452,7 +452,7 @@ class tx_Workspaces_Service_Workspaces implements t3lib_Singleton {
                if (is_array($recs)) {
                        foreach ($recs as $rec) {
                                $page = t3lib_beFunc::getRecord('pages', $rec[$checkField], 'uid,pid,perms_userid,perms_user,perms_groupid,perms_group,perms_everybody');
-                               if ($GLOBALS['BE_USER']->doesUserHaveAccess($page, 1)) {
+                               if ($GLOBALS['BE_USER']->doesUserHaveAccess($page, 1) && $this->isLanguageAccessibleForCurrentUser($table, $rec)) {
                                        $permittedElements[] = $rec;
                                }
                        }
@@ -460,6 +460,22 @@ class tx_Workspaces_Service_Workspaces implements t3lib_Singleton {
                return $permittedElements;
        }
 
+       /**
+       * Check current be users language access on given record.
+       *
+       * @param string $table Name of the table
+       * @param array $record Record row to be checked
+       * @return boolean
+       */
+       protected function isLanguageAccessibleForCurrentUser($table, array $record) {
+               $languageUid = 0;
+
+               if (t3lib_BEfunc::isTableLocalizable($table)) {
+                       $languageUid = $record[$GLOBALS['TCA'][$table]['ctrl']['languageField']];
+               }
+
+               return $GLOBALS['BE_USER']->checkLanguageAccess($languageUid);
+       }
 
        /**
         * Trivial check to see if the user already migrated his workspaces