Ejemplo n.º 1
0
 public function setRole(Role $role)
 {
     $this->roles[$role->getRoleId()] = $role;
 }
Ejemplo n.º 2
0
 public function hasAuthority(Role $role, Resource $resource)
 {
     $authority = $this->findRuleByRoleAndResource($role->getRoleId(), $resource->getResourceId());
     if (is_null($authority) || !$authority->isAllowed()) {
         throw new SecurityException(MessageCode::SECURITY_ACCESS_DENIED);
     }
 }