mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
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:
parent
a1a3b355d0
commit
7df00b12bf
@ -15,16 +15,9 @@
|
||||
class StaticExporter extends Controller {
|
||||
function init() {
|
||||
parent::init();
|
||||
if(!Permission::check('ADMIN')) {
|
||||
$messageSet = array(
|
||||
'default' => _t('LeftAndMain.PERMDEFAULT', 'Enter your email address and password to access the CMS.'),
|
||||
'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;
|
||||
}
|
||||
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
||||
if(!$canAccess) return Security::permissionFailure($this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,10 +7,12 @@
|
||||
*/
|
||||
class RebuildStaticCacheTask extends Controller {
|
||||
function init() {
|
||||
parent::init();
|
||||
|
||||
Versioned::reading_stage('live');
|
||||
|
||||
if(!Director::is_cli() && !Director::isDev() && !Permission::check("ADMIN")) Security::permissionFailure();
|
||||
parent::init();
|
||||
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
||||
if(!$canAccess) return Security::permissionFailure($this);
|
||||
}
|
||||
|
||||
function index() {
|
||||
|
Loading…
Reference in New Issue
Block a user