mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Unified permission control for i18nTextCollectorTask, TaskRunner, TestRunner, ModelViewer, DevelopmentAdmin, TestViewer, MigrateTranslatableTask
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@86005 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
fc03a8608a
commit
0cf75cfc65
@ -13,8 +13,10 @@ class i18nTextCollectorTask extends BuildTask {
|
|||||||
";
|
";
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
if(!Director::is_cli() && !Director::isDev() && !Permission::check("ADMIN")) Security::permissionFailure();
|
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
|
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
||||||
|
if(!$canAccess) return Security::permissionFailure($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,16 +21,8 @@ class DevelopmentAdmin extends Controller {
|
|||||||
|
|
||||||
// We allow access to this controller regardless of live-status or ADMIN permission only
|
// We allow access to this controller regardless of live-status or ADMIN permission only
|
||||||
// if on CLI. Access to this controller is always allowed in "dev-mode", or of the user is ADMIN.
|
// if on CLI. Access to this controller is always allowed in "dev-mode", or of the user is ADMIN.
|
||||||
$canAccess = (
|
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
||||||
Director::isDev()
|
if(!$canAccess) return Security::permissionFailure($this);
|
||||||
|| Director::is_cli()
|
|
||||||
|| Permission::check("ADMIN")
|
|
||||||
);
|
|
||||||
if(!$canAccess) {
|
|
||||||
return Security::permissionFailure($this,
|
|
||||||
"This page is secured and you need administrator rights to access it. " .
|
|
||||||
"Enter your credentials below and we will send you right along.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for valid url mapping
|
// check for valid url mapping
|
||||||
// lacking this information can cause really nasty bugs,
|
// lacking this information can cause really nasty bugs,
|
||||||
|
@ -21,7 +21,9 @@ class ModelViewer extends Controller {
|
|||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
if(!Permission::check("ADMIN")) Security::permissionFailure();
|
|
||||||
|
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
||||||
|
if(!$canAccess) return Security::permissionFailure($this);
|
||||||
|
|
||||||
// check for graphviz dependencies
|
// check for graphviz dependencies
|
||||||
$returnCode = 0;
|
$returnCode = 0;
|
||||||
|
@ -10,6 +10,13 @@ class TaskRunner extends Controller {
|
|||||||
'$TaskName' => 'runTask'
|
'$TaskName' => 'runTask'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
||||||
|
if(!$canAccess) return Security::permissionFailure($this);
|
||||||
|
}
|
||||||
|
|
||||||
function index() {
|
function index() {
|
||||||
$tasks = $this->getTasks();
|
$tasks = $this->getTasks();
|
||||||
|
|
||||||
|
@ -59,6 +59,10 @@ class TestRunner extends Controller {
|
|||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
|
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
||||||
|
if(!$canAccess) return Security::permissionFailure($this);
|
||||||
|
|
||||||
ManifestBuilder::load_test_manifest();
|
ManifestBuilder::load_test_manifest();
|
||||||
if (!self::$default_reporter) self::set_reporter(Director::is_cli() ? 'CliDebugView' : 'DebugView');
|
if (!self::$default_reporter) self::set_reporter(Director::is_cli() ? 'CliDebugView' : 'DebugView');
|
||||||
|
|
||||||
|
@ -66,6 +66,13 @@ class TestViewer extends Controller {
|
|||||||
'*' => array('', 'potentialMethodCall'),
|
'*' => array('', 'potentialMethodCall'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
||||||
|
if(!$canAccess) return Security::permissionFailure($this);
|
||||||
|
}
|
||||||
|
|
||||||
function createClass($token) {
|
function createClass($token) {
|
||||||
$this->currentClass = array();
|
$this->currentClass = array();
|
||||||
|
@ -42,8 +42,10 @@ class MigrateTranslatableTask extends BuildTask {
|
|||||||
protected $description = "Migrates site translations from SilverStripe 2.1/2.2 to new database structure.";
|
protected $description = "Migrates site translations from SilverStripe 2.1/2.2 to new database structure.";
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
if(!Director::is_cli() && !Director::isDev() && !Permission::check("ADMIN")) Security::permissionFailure();
|
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
|
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
||||||
|
if(!$canAccess) return Security::permissionFailure($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
function run($request) {
|
function run($request) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user