Fixed bug #16600: TCA tree: Move the ACL-Checks out from Data-Provider and use the...
authorSteffen Ritter <info@rs-websystems.de>
Mon, 29 Nov 2010 12:12:54 +0000 (12:12 +0000)
committerSteffen Ritter <info@rs-websystems.de>
Mon, 29 Nov 2010 12:12:54 +0000 (12:12 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9668 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/tceforms/class.t3lib_tceforms_tree.php
t3lib/tree/tca/class.t3lib_tree_tca_databasetreedataprovider.php

index 7117105..9328f97 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2010-11-29  Steffen Ritter  <typo3@steffen-ritter.net>
 
        * Fixed bug #16597: TCA tree: Adapt Signature of own select renderMode tree to match the signature other select-modes 
+       * Fixed bug #16600: TCA tree: Move the ACL-Checks out from Data-Provider and use the information from tceFroms 
 
 2010-11-29  Jigal van Hemert <jigal@xs4all.nl>
 
index 0e6bb00..3cb5a37 100644 (file)
@@ -73,7 +73,12 @@ class t3lib_TCEforms_Tree {
                                $selectedNodes[] = $temp[0];
                        }
                }
-
+               $allowedUids = array();
+               foreach ($possibleSelectboxItems as $item) {
+                       if (intval($item[1]) > 0) {
+                               $allowedUids[] = $item[1];
+                       }
+               }
                $treeDataProvider = t3lib_tree_Tca_DataProviderFactory::getDataProvider(
                        $GLOBALS['TCA'][$table]['columns'][$field]['config'],
                        $table,
@@ -81,8 +86,8 @@ class t3lib_TCEforms_Tree {
                        $row
                );
                $treeDataProvider->setSelectedList(implode(',', $selectedNodes));
+               $treeDataProvider->setItemWhiteList($allowedUids);
                $treeDataProvider->initializeTreeData();
-               $treeDataProvider->setGeneratedTSConfig($this->tceForms->setTSconfig($table, $row));
 
                $treeRenderer = t3lib_div::makeInstance('t3lib_tree_Tca_ExtJsArrayRenderer');
                $tree = t3lib_div::makeInstance('t3lib_tree_Tca_TcaTree');
index 7b8940c..463eed2 100644 (file)
@@ -79,13 +79,6 @@ class t3lib_tree_Tca_DatabaseTreeDataProvider extends t3lib_tree_Tca_AbstractTca
         */
        protected $idCache = array();
 
-       /**
-        * uidWhiteList contains all Uids which may be allowed to display according to
-        * beUser Rights and foreign_table_where
-        *
-        * @var array $uidWhiteList
-        */
-       protected $uidWhiteList = array();
 
        /**
         * node sort values (the orderings from foreign_Table_where evaluation)
@@ -283,7 +276,7 @@ class t3lib_tree_Tca_DatabaseTreeDataProvider extends t3lib_tree_Tca_AbstractTca
         */
        public function initializeTreeData() {
                parent::initializeTreeData();
-               $this->generateUidWhitelist();
+               $this->nodeSortValues = array_flip($this->itemWhiteList);
 
                $this->treeData = t3lib_div::makeInstance('t3lib_tree_Node');
                $this->treeData->setId($this->getRootUid());
@@ -352,7 +345,7 @@ class t3lib_tree_Tca_DatabaseTreeDataProvider extends t3lib_tree_Tca_AbstractTca
 
                $allowedArray = array();
                foreach ($children as $child) {
-                       if (!in_array($child, $this->idCache) && in_array($child, $this->uidWhiteList)) {
+                       if (!in_array($child, $this->idCache) && in_array($child, $this->itemWhiteList)) {
                                $allowedArray[] = $child;
                        }
                }
@@ -363,27 +356,6 @@ class t3lib_tree_Tca_DatabaseTreeDataProvider extends t3lib_tree_Tca_AbstractTca
        }
 
        /**
-        * Uses the function in of core to determine "select" elemnents, to
-        * get all allowed elements for this tree and their orderings.
-        * Will take of user rights
-        *
-        * @return void
-        */
-       protected function generateUidWhitelist() {
-               $res = t3lib_BEfunc::exec_foreign_table_where_query(
-                       $GLOBALS['TCA'][$this->getTableName()]['columns'][$this->getLookupField()],
-                       $this->getLookupField(),
-                       $this->getGeneratedTSConfig(),
-                       ''
-               );
-               while ($tempRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                       $this->uidWhiteList[] = $tempRow['uid'];
-               }
-               $GLOBALS['TYPO3_DB']->sql_free_result($res);
-
-               $this->nodeSortValues = array_flip($this->uidWhiteList);
-       }
-       /**
         * Gets related records depending on TCA configuration
         *
         * @param  $row
@@ -497,26 +469,6 @@ class t3lib_tree_Tca_DatabaseTreeDataProvider extends t3lib_tree_Tca_AbstractTca
                return $relatedUids;
        }
 
-       /**
-        * Setter for the TSConfig from TCEforms
-        * used to evalualate and replace markers in foreign_table_where
-        *
-        * @param array $generatedTSConfig
-        * @return void
-        */
-       public function setGeneratedTSConfig(array $generatedTSConfig) {
-               $this->generatedTSConfig = $generatedTSConfig;
-       }
-
-       /**
-        * Getter for the TSConfig from TCEforms
-        *
-        * @return array
-        */
-       public function getGeneratedTSConfig() {
-               return $this->generatedTSConfig;
-       }
-
 }
 
 ?>
\ No newline at end of file