mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02: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/';
|
||||
|
||||
/**
|
||||
* @var String|array Optional permssion check
|
||||
*/
|
||||
static $check_permission = 'ADMIN';
|
||||
|
||||
function 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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user