MINOR Unified permission control for RebuildStaticCacheTask and StaticExporter

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@86004 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-09-10 01:49:07 +00:00
parent a1a3b355d0
commit 7df00b12bf
2 changed files with 7 additions and 12 deletions

View File

@ -15,16 +15,9 @@
class StaticExporter extends Controller { class StaticExporter extends Controller {
function init() { function init() {
parent::init(); parent::init();
if(!Permission::check('ADMIN')) {
$messageSet = array( $canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
'default' => _t('LeftAndMain.PERMDEFAULT', 'Enter your email address and password to access the CMS.'), if(!$canAccess) return Security::permissionFailure($this);
'alreadyLoggedIn' => _t('LeftAndMain.PERMALREADY', 'I\'m sorry, but you can\'t access that part of the CMS. If you want to log in as someone else, do so below'),
'logInAgain' => _t('LeftAndMain.PERMAGAIN', 'You have been logged out of the CMS. If you would like to log in again, enter a username and password below.'),
);
Security::permissionFailure($this, $messageSet);
return;
}
} }

View File

@ -7,10 +7,12 @@
*/ */
class RebuildStaticCacheTask extends Controller { class RebuildStaticCacheTask extends Controller {
function init() { function init() {
parent::init();
Versioned::reading_stage('live'); Versioned::reading_stage('live');
if(!Director::is_cli() && !Director::isDev() && !Permission::check("ADMIN")) Security::permissionFailure(); $canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
parent::init(); if(!$canAccess) return Security::permissionFailure($this);
} }
function index() { function index() {