Require the module's permission for every module automatically
Module permissions are not required if authentication is disabled on the controller. refs #9644
This commit is contained in:
parent
7c5b4de087
commit
b4f4ce4406
|
@ -5,6 +5,7 @@ namespace Icinga\Web\Controller;
|
|||
|
||||
use Icinga\Application\Config;
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Application\Modules\Manager;
|
||||
|
||||
/**
|
||||
* Base class for module action controllers
|
||||
|
@ -24,17 +25,6 @@ class ModuleActionController extends ActionController
|
|||
*/
|
||||
protected $moduleName;
|
||||
|
||||
/**
|
||||
* Whether the module permission is required to access to module
|
||||
*
|
||||
* Note that module permissions do not have any effect if the controller does not require authentication.
|
||||
*
|
||||
* @var bool
|
||||
*
|
||||
* @see $requiresAuthentication For enabling/disabling whether the controller requires authentication.
|
||||
*/
|
||||
protected $requiresModulePermission = true;
|
||||
|
||||
/**
|
||||
* (non-PHPDoc)
|
||||
* @see \Icinga\Web\Controller\ActionController For the method documentation.
|
||||
|
@ -45,6 +35,7 @@ class ModuleActionController extends ActionController
|
|||
$this->_helper->layout()->moduleName = $this->moduleName;
|
||||
$this->view->translationDomain = $this->moduleName;
|
||||
$this->moduleInit();
|
||||
$this->assertPermission(Manager::MODULE_PERMISSION_NS . $this->moduleName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,29 +45,6 @@ class ModuleActionController extends ActionController
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether the module permission is required to access to module
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getRequiresModulePermission()
|
||||
{
|
||||
return $this->requiresModulePermission;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether the module permission is required to access to module
|
||||
*
|
||||
* @param bool $required
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRequiresModulePermission($required)
|
||||
{
|
||||
$this->requiresModulePermission = (bool) $required;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function Config($file = null)
|
||||
{
|
||||
if ($file === null) {
|
||||
|
|
Loading…
Reference in New Issue