mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 09:05:56 +00:00
ENHANCEMENT Make permission checks configurable
This commit is contained in:
parent
591b87e939
commit
281e6e1ea7
@ -41,10 +41,15 @@ class DocumentationViewer extends Controller {
|
|||||||
*/
|
*/
|
||||||
protected static $link_base = 'dev/docs/';
|
protected static $link_base = 'dev/docs/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var String|array Optional permssion check
|
||||||
|
*/
|
||||||
|
static $check_permission = 'ADMIN';
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
$canAccess = (Director::isDev() || Director::is_cli() || !self::$check_permission || Permission::check(self::$check_permission));
|
||||||
|
|
||||||
if(!$canAccess) return Security::permissionFailure($this);
|
if(!$canAccess) return Security::permissionFailure($this);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user