Revert "[BUGFIX] Make sys_file_metadata publishable" 85/34185/2
authorHelmut Hummel <helmut.hummel@typo3.org>
Fri, 14 Nov 2014 19:58:00 +0000 (20:58 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Fri, 14 Nov 2014 19:59:05 +0000 (20:59 +0100)
This failed a lot of tests. Needs more investigation.

This reverts commit 8f06c8d6e40a205cb721b48e3adf5168c049044c.

Change-Id: I4409fb8cf6dfca43d33a798b1b55853d4252ace9
Reviewed-on: http://review.typo3.org/34185
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/workspaces/Classes/Service/WorkspaceService.php

index 1fbd546..db3f73a 100644 (file)
@@ -186,14 +186,13 @@ class WorkspaceService implements \TYPO3\CMS\Core\SingletonInterface {
                $wsid = (int)$wsid;
                $filter = (int)$filter;
                $output = array();
-               // Include root level page as there might be some records with where root level restriction is ignored (e.g. FAL records)
-               $pageList = '0,';
                // Contains either nothing or a list with live-uids
                if ($pageId != -1 && $recursionLevel > 0) {
-                       $pageList .= $this->getTreeUids($pageId, $wsid, $recursionLevel);
+                       $pageList = $this->getTreeUids($pageId, $wsid, $recursionLevel);
                } elseif ($pageId != -1) {
-                       $pageList .= $pageId;
+                       $pageList = $pageId;
                } else {
+                       $pageList = '';
                        // check if person may only see a "virtual" page-root
                        $mountPoints = array_map('intval', $GLOBALS['BE_USER']->returnWebmounts());
                        $mountPoints = array_unique($mountPoints);
@@ -202,7 +201,7 @@ class WorkspaceService implements \TYPO3\CMS\Core\SingletonInterface {
                                foreach ($mountPoints as $mountPoint) {
                                        $tempPageIds[] = $this->getTreeUids($mountPoint, $wsid, $recursionLevel);
                                }
-                               $pageList .= implode(',', $tempPageIds);
+                               $pageList = implode(',', $tempPageIds);
                        }
                }
                // Traversing all tables supporting versioning:
@@ -414,10 +413,12 @@ class WorkspaceService implements \TYPO3\CMS\Core\SingletonInterface {
         * @return array
         */
        protected function filterPermittedElements($recs, $table) {
+               $checkField = $table == 'pages' ? 'uid' : 'wspid';
                $permittedElements = array();
                if (is_array($recs)) {
                        foreach ($recs as $rec) {
-                               if ($this->isPageAccessibleForCurrentUser($table, $rec) && $this->isLanguageAccessibleForCurrentUser($table, $rec)) {
+                               $page = BackendUtility::getRecord('pages', $rec[$checkField], 'uid,pid,perms_userid,perms_user,perms_groupid,perms_group,perms_everybody');
+                               if ($GLOBALS['BE_USER']->doesUserHaveAccess($page, 1) && $this->isLanguageAccessibleForCurrentUser($table, $rec)) {
                                        $permittedElements[] = $rec;
                                }
                        }
@@ -426,27 +427,6 @@ class WorkspaceService implements \TYPO3\CMS\Core\SingletonInterface {
        }
 
        /**
-        * Checking access to the page the record is on, respecting ignored root level restrictions
-        *
-        * @param string $table Name of the table
-        * @param array $record Record row to be checked
-        * @return bool
-        */
-       protected function isPageAccessibleForCurrentUser($table, array $record) {
-               $pageIdField = $table === 'pages' ? 'uid' : 'wspid';
-               $pageId = isset($record[$pageIdField]) ? (int)$record[$pageIdField] : NULL;
-               if ($pageId === NULL) {
-                       return FALSE;
-               }
-               if ($pageId === 0 && BackendUtility::isRootLevelRestrictionIgnored($table)) {
-                       return TRUE;
-               }
-               $page = BackendUtility::getRecord('pages', $pageId, 'uid,pid,perms_userid,perms_user,perms_groupid,perms_group,perms_everybody');
-
-               return $GLOBALS['BE_USER']->doesUserHaveAccess($page, 1);
-       }
-
-       /**
         * Check current be users language access on given record.
         *
         * @param string $table Name of the table
@@ -454,6 +434,7 @@ class WorkspaceService implements \TYPO3\CMS\Core\SingletonInterface {
         * @return boolean
         */
        protected function isLanguageAccessibleForCurrentUser($table, array $record) {
+               $languageUid = 0;
                if (BackendUtility::isTableLocalizable($table)) {
                        $languageUid = $record[$GLOBALS['TCA'][$table]['ctrl']['languageField']];
                } else {