Fixed bug #485: Hookrequest for ~ TemplaVoila unlink doesn't work for Non-Admins...
authorSteffen Kamper <info@sk-typo3.de>
Sat, 10 Apr 2010 20:59:06 +0000 (20:59 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Sat, 10 Apr 2010 20:59:06 +0000 (20:59 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7272 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tcemain.php

index 36b4718..05ba681 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-10  Steffen Kamper  <info@sk-typo3.de>
+
+       * Fixed bug #485: Hookrequest for ~ TemplaVoila unlink doesn't work for Non-Admins (thanks to Tolleiv Nietsch)
+
 2010-04-10  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Added feature #14051: htmlArea RTE: Streamline the RTE loading process
index 3841c30..2d817ba 100644 (file)
@@ -757,7 +757,7 @@ class t3lib_TCEmain {
                                                        $status = 'new';                                                // Yes new record, change $record_status to 'insert'
                                                } else {        // Nope... $id is a number
                                                        $fieldArray = array();
-                                                       $recordAccess = $this->checkRecordUpdateAccess($table,$id);
+                                                       $recordAccess = $this->checkRecordUpdateAccess($table, $id, $data, $hookObjectsArr);
                                                        if (!$recordAccess)             {
                                                                $propArr = $this->getRecordProperties($table,$id);
                                                                $this->log($table,$id,2,0,1,"Attempt to modify record '%s' (%s) without permission. Or non-existing page.",2,array($propArr['header'],$table.':'.$id),$propArr['event_pid']);
@@ -5574,11 +5574,26 @@ $this->log($table,$id,6,0,0,'Stage raised...',30,array('comment'=>$comment,'stag
         *
         * @param       string          Record table
         * @param       integer         Record UID
+        * @param       array           Record data
+        * @param       array           Hook objects
         * @return      boolean         Returns true if the user may update the record given by $table and $id
         */
-       function checkRecordUpdateAccess($table,$id)    {
+       function checkRecordUpdateAccess($table, $id, $data=false, &$hookObjectsArr = false) {
                global $TCA;
-               $res = 0;
+               $res = NULL;
+               if (is_array($hookObjectsArr)) {
+                       foreach($hookObjectsArr as $hookObj) {
+                               if (method_exists($hookObj, 'checkRecordUpdateAccess')) {
+                                       $res = $hookObj->checkRecordUpdateAccess($table, $id, $data, $res, $this);
+                               }
+                       }
+               }
+               if($res === 1 || $res === 0) {
+                       return $res;
+               } else {
+                       $res = 0;
+               }
+
                if ($TCA[$table] && intval($id)>0)      {
                        if (isset($this->recUpdateAccessCache[$table][$id]))    {       // If information is cached, return it
                                return $this->recUpdateAccessCache[$table][$id];