add method check_access()

just like in SeedDMS_View_Common
This commit is contained in:
Uwe Steinmann 2019-11-08 08:03:02 +01:00
parent 1c08d83704
commit 7362bf192b

View File

@ -246,4 +246,25 @@ class SeedDMS_Controller_Common {
return false;
} /* }}} */
/**
* Check if the access on the contoller with given name or the current
* controller itself may be accessed.
*
* The function requires the parameter 'accessobject' to be available in the
* controller, because it calls SeedDMS_AccessOperation::check_controller_access()
* to check access rights. If the the optional $name is not set the
* current controller is used.
*
* @param string|array $name name of controller or list of controller names
* @return boolean true if access is allowed otherwise false
*/
protected function check_access($name='') { /* {{{ */
if(!$name)
$name = $this;
if(!isset($this->params['accessobject']))
return false;
$access = $this->params['accessobject']->check_controller_access($name);
return $access;
} /* }}} */
}