mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-12 12:41:30 +00:00
check_view_access() returns true/false and also takes admin role into account
This commit is contained in:
parent
d2b2bd0226
commit
e22ca653ed
|
@ -348,11 +348,16 @@ class SeedDMS_AccessOperation {
|
||||||
* Check for access permission on view
|
* Check for access permission on view
|
||||||
*
|
*
|
||||||
* If the parameter $view is an array then each element is considered the
|
* If the parameter $view is an array then each element is considered the
|
||||||
* name of a view and true will be returned if one is accesible.
|
* name of a view and true will be returned if one is accessible.
|
||||||
|
* Whether access is allowed also depends on the currently logged in user
|
||||||
|
* stored in the view object. If the user is an admin the access
|
||||||
|
* on a view must be explicitly disallowed. For regular users the access
|
||||||
|
* must be explicitly allowed.
|
||||||
*
|
*
|
||||||
* @param mixed $view Instanz of view, name of view or array of view names
|
* @param mixed $view Instanz of view, name of view or array of view names
|
||||||
* @param string $get query parameters
|
* @param string $get query parameters
|
||||||
* @return boolean true if access is allowed otherwise false
|
* @return boolean true if access is allowed, false if access is disallowed
|
||||||
|
* no specific access right is set, otherwise false
|
||||||
*/
|
*/
|
||||||
function check_view_access($view, $get=array()) { /* {{{ */
|
function check_view_access($view, $get=array()) { /* {{{ */
|
||||||
if(!$this->settings->_advancedAcl)
|
if(!$this->settings->_advancedAcl)
|
||||||
|
@ -373,7 +378,8 @@ class SeedDMS_AccessOperation {
|
||||||
$this->_aro = SeedDMS_Aro::getInstance($this->user->getRole(), $this->dms);
|
$this->_aro = SeedDMS_Aro::getInstance($this->user->getRole(), $this->dms);
|
||||||
foreach($scripts as $script) {
|
foreach($scripts as $script) {
|
||||||
$aco = SeedDMS_Aco::getInstance($scope.'/'.$script.'/'.$action, $this->dms);
|
$aco = SeedDMS_Aco::getInstance($scope.'/'.$script.'/'.$action, $this->dms);
|
||||||
if($acl->check($this->_aro, $aco))
|
$ll = $acl->check($this->_aro, $aco);
|
||||||
|
if($ll === 1 && !$this->user->isAdmin() || $ll !== -1 && $this->user->isAdmin())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user