Feature #6167: Do not check owner by default - make it configurable
authorstephenking <stephenking@735d13b6-9817-0410-8766-e36946ffe9aa>
Thu, 11 Feb 2010 21:40:45 +0000 (21:40 +0000)
committerstephenking <stephenking@735d13b6-9817-0410-8766-e36946ffe9aa>
Thu, 11 Feb 2010 21:40:45 +0000 (21:40 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/stg_clearcache/trunk@29946 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog
class.tx_stgclearcache.php
ext_autoload.php [new file with mode: 0644]
ext_php_api.dat [new file with mode: 0644]

index 6cf27a6..bf0c975 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-02-11 Steffen Gebert  <steffen@steffen-gebert.de>
+       * Release of version 2.1.0
+       * Feature #6167: Changed default behavior to have no limitations for cache clearing
+       * Feature: Added manual
+       * Feature: Added ext_autoload.php
+
 2009-10-02 Steffen Gebert  <steffen@steffen-gebert.de>
 
        * initial release 2.0.0 in TER
index e2c8b6e..6ce3688 100755 (executable)
@@ -2,7 +2,8 @@
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2009 Steffen Gebert (steffen@steffen-gebert.de)
+ *  (c) 2009-2010 Steffen Gebert (steffen@steffen-gebert.de)
+ *                for Freie W√§hler Bayern e.V.
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 /**
+ * Recursive cache clearing
+ * $Id$
+ * @author Steffen Gebert
+ */
+/**
  * [CLASS/FUNCTION INDEX of SCRIPT]
  *
  *
@@ -42,6 +48,9 @@ class tx_stgclearcache {
        /* @var $tceMainInstance t3lib_TCEmain */
        var $tceMainInstance;
 
+       /* @var $id Page ID */
+       var $id;
+
        /**
         * Clear cache post processor.
         * The same structure as t3lib_TCEmain::clear_cache
@@ -60,12 +69,9 @@ class tx_stgclearcache {
                                $this->tceMainInstance = t3lib_div::makeInstance('t3lib_TCEmain');
                        }
 
-                       if ($GLOBALS['BE_USER']->user['admin']) {
-                               $perms_clause = '1=1';
-                       }
-                       else {
-                               $perms_clause = 'perms_userid=' . intval($GLOBALS['BE_USER']->user["uid"]);
-                       }
+                       $this->id = $params['cacheCmd'];
+
+                       $perms_clause = $this->getPermsClause();
 
                        // read out all pages below this one
                        // it's not possible, to directly get ALL pages below, because this function is also
@@ -89,6 +95,39 @@ class tx_stgclearcache {
                        }
                }
        }
+
+       /**
+        * Calculates the WHERE clause based on the user's permissions
+        * 
+        * @return      void
+        */
+       function getPermsClause() {
+
+                       // by default, everybody is allowed
+               $perms_clause = '1=1';
+
+                       // we don't have to check anything for admins
+               if (!$GLOBALS['BE_USER']->isAdmin()) {
+                       $pageTS = t3lib_BEfunc::getPagesTSconfig($this->id);
+                       $accessCheck = $pageTS['options.']['tx_stgclearcache.']['accessCheck'];
+                       switch ($accessCheck) {
+                               case 'ownerUser':
+                                       $perms_clause = 'perms_userid=' . intval($GLOBALS['BE_USER']->user['uid']);
+                                       break;
+                               case 'ownerGroup':
+                                       $perms_clause = 'perms_groupid IN (' . $GLOBALS['BE_USER']->user['groups'] . ')';
+                                       break;
+                               case 'read':
+                                       $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
+                                       break;
+                               case 'write':
+                                       $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(2);
+                                       break;
+                       }
+               }
+               return $perms_clause;
+       }
+
 }
 
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/stg_clearcache/class.tx_stgclearcache.php']) {
diff --git a/ext_autoload.php b/ext_autoload.php
new file mode 100644 (file)
index 0000000..bce50e6
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+// DO NOT CHANGE THIS FILE! It is automatically generated by extdeveval::buildAutoloadRegistry.
+// This file was generated on 2010-02-11 22:01
+
+$extensionPath = t3lib_extMgm::extPath('stg_clearcache');
+return array(
+       'tx_stgclearcache' => $extensionPath . 'class.tx_stgclearcache.php',
+);
+?>
\ No newline at end of file
diff --git a/ext_php_api.dat b/ext_php_api.dat
new file mode 100644 (file)
index 0000000..56ea511
--- /dev/null
@@ -0,0 +1,19 @@
+a:2:{s:4:"meta";a:3:{s:5:"title";s:0:"";s:5:"descr";s:0:"";s:7:"options";a:2:{s:10:"usageCount";N;s:19:"includeCodeAbstract";N;}}s:5:"files";a:1:{s:14:"MD5_d8b3f12a3d";a:4:{s:8:"filename";s:26:"class.tx_stgclearcache.php";s:8:"filesize";i:4192;s:6:"header";a:5:{s:4:"text";s:31:"
+
+Recursive cache clearing
+$Id$";s:5:"param";a:0:{}s:6:"return";a:2:{i:0;s:6:"[type]";i:1;s:3:"...";}s:5:"other";a:1:{i:0;s:22:"@author Steffen Gebert";}s:11:"other_index";a:1:{s:7:"@author";a:1:{i:0;s:14:"Steffen Gebert";}}}s:3:"DAT";a:3:{i:1;a:8:{s:6:"header";s:24:"class tx_stgclearcache {";s:5:"class";i:1;s:11:"parentClass";s:16:"tx_stgclearcache";s:4:"cDat";a:3:{s:4:"text";s:220:"
+
+[CLASS/FUNCTION INDEX of SCRIPT]
+
+
+
+  36: class tx_stgclearcache
+  53:     function clearCachePostProc (&$params, &$pObj)
+
+TOTAL FUNCTIONS: 1
+(This index is automatically created/updated by the extension "extdeveval")
+";s:5:"param";a:0:{}s:6:"return";a:2:{i:0;s:6:"[type]";i:1;s:3:"...";}}s:7:"content";s:0:"";s:12:"content_size";i:225;s:13:"content_lines";i:11;s:6:"atLine";i:40;}i:3;a:4:{s:6:"header";s:48:"function clearCachePostProc (&$params, &$pObj) {";s:11:"parentClass";s:16:"tx_stgclearcache";s:4:"cDat";a:3:{s:4:"text";s:79:"
+
+Clear cache post processor.
+The same structure as t3lib_TCEmain::clear_cache
+";s:5:"param";a:2:{i:0;a:2:{i:0;s:6:"object";i:1;s:25:"$_params: parameter array";}i:1;a:2:{i:0;s:6:"object";i:1;s:21:"$pObj: partent object";}}s:6:"return";a:2:{i:0;s:4:"void";i:1;s:0:"";}}s:6:"atLine";i:60;}i:5;a:6:{s:6:"header";s:27:"function getPermsClause() {";s:11:"parentClass";s:16:"tx_stgclearcache";s:7:"content";s:0:"";s:12:"content_size";i:1008;s:13:"content_lines";i:31;s:6:"atLine";i:102;}}}}}
\ No newline at end of file