From 172ec4e425cfc56b8261859b0ee9135d788c1021 Mon Sep 17 00:00:00 2001 From: Ingo Renner Date: Sat, 15 Mar 2008 16:43:57 +0000 Subject: [PATCH] Added follow up to #7588: Accesscheck for clearCache, credits Steffen Kamper git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3426 709f56b5-9817-0410-a4d7-c38de5d9e867 --- ChangeLog | 4 ++++ typo3/alt_menu.php | 21 +++++++++++++-------- typo3/classes/class.clearcachemenu.php | 9 +++++++-- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed721475852..dbf508ac0b5 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-03-15 Ingo Renner + + * Added follow up to #7588: Accesscheck for clearCache, credits Steffen Kamper + 2008-03-15 Stanislas Rolland * Fixed bug #7857: htmlArea RTE: hidePStyleItems does not work anymore diff --git a/typo3/alt_menu.php b/typo3/alt_menu.php index 7797561053b..71e1aabc341 100755 --- a/typo3/alt_menu.php +++ b/typo3/alt_menu.php @@ -131,8 +131,10 @@ class SC_alt_menu { $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions'); $this->content.= $alt_menuObj->topMenu($this->loadModules->modules); - // clear cache commands for Admins - if($BE_USER->isAdmin()) { // && $BE_USER->workspace===0 NOT used anyway because under a workspace developers might still like to clear cache! + // clear cache commands for Admins and allowed users + if($GLOBALS['BE_USER']->isAdmin() + || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages') + || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')) { // && $BE_USER->workspace===0 NOT used anyway because under a workspace developers might still like to clear cache! $functionsArray = $alt_menuObj->adminFunctions($backPath); $this->content.=' @@ -154,12 +156,15 @@ class SC_alt_menu { '; $rows=array(); - foreach($functionsArray as $functionsArraySetup) { - $rows[]=' - - '.$functionsArraySetup['icon'].' - '.htmlspecialchars($functionsArraySetup['title']).' - '; + foreach($functionsArray as $functionsArraySetup) { + if(($functionsArraySetup['id'] == 'all' && ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all'))) + || ($functionsArraySetup['id'] == 'temp_CACHED' && $GLOBALS['BE_USER']->isAdmin())) { + $rows[]=' + + '.$functionsArraySetup['icon'].' + '.htmlspecialchars($functionsArraySetup['title']).' + '; + } } // Imploding around the divider table row: diff --git a/typo3/classes/class.clearcachemenu.php b/typo3/classes/class.clearcachemenu.php index f7839460bd0..83949462b53 100644 --- a/typo3/classes/class.clearcachemenu.php +++ b/typo3/classes/class.clearcachemenu.php @@ -65,6 +65,7 @@ class ClearCacheMenu implements backend_toolbarItem { 'icon' => 'backPath, 'gfx/lightning_red.png', 'width="16" height="16"').' title="'.htmlspecialchars($title).'" alt="" />' ); } + // Clear cache for either ALL pages if($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages')) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_pages'); @@ -77,7 +78,7 @@ class ClearCacheMenu implements backend_toolbarItem { } // Clearing of cache-files in typo3conf/ + menu - if ($GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache']) { + if($GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache']) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_allTypo3Conf'); $this->cacheActions[] = array( 'id' => 'temp_CACHED', @@ -95,7 +96,11 @@ class ClearCacheMenu implements backend_toolbarItem { * @return boolean true if user has access, false if not */ public function checkAccess() { - return ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages') || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages')); + return ( + $GLOBALS['BE_USER']->isAdmin() + || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages') + || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all') + ); } /** -- 2.20.1