Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
AclControllerTrait.php
Go to the documentation of this file.
1<?php
2
4
8
19 public abstract function _getRole();
20
28 protected function isValidRole($action,$role) {
29 $controller=\get_class($this);
30 $resourceController = AclManager::getPermissionMap ()->getRessourcePermission ( $controller, $action );
31 if (isset ( $resourceController )) {
32 try{
33 if (AclManager::isAllowed ( $role, $resourceController ['resource'], $resourceController ['permission'] )) {
34 return true;
35 }
36 }
37 catch(AclException $e){
38 Logger::alert('Router', $role.' is not allowed for this resource','Acls',[$controller,$action]);
39 }
40 }
41 return false;
42 }
50 public function isValid($action) {
51 return $this->isValidRole($action, $this->_getRole());
52 }
53}
54
Ubiquity\exceptions$AclException This class is part of Ubiquity.
Abstract class for logging Ubiquity\log$Logger This class is part of Ubiquity.
Definition Logger.php:14
static alert($context, $message, $part=null, $extra=null)
Definition Logger.php:82
Ubiquity\security\acl$AclManager This class is part of Ubiquity.
static isAllowed(string $role, ?string $resource=' *', ?string $permission='ALL')
Check if access to resource is allowed for role with the permission.
isValidRole($action, $role)
Returns True if access to the controller is allowed for $role.
isValid($action)
Returns True if access to the controller is allowed for the role returned by _getRole method.