getName() public method

Method to get the role name
public getName ( ) : string
return string
Ejemplo n.º 1
0
 /**
  * Method to determine if the user is denied
  *
  * @param  \Pop\Auth\Role $user
  * @param  string         $resource
  * @param  string         $permission
  * @throws \Pop\Auth\Exception
  * @return boolean
  */
 public function isDenied(\Pop\Auth\Role $user, $resource = null, $permission = null)
 {
     $result = false;
     if (!isset($this->roles[$user->getName()])) {
         throw new Exception('Error: That role has not been added.');
     }
     if (null !== $resource && !isset($this->resources[$resource])) {
         $this->addResource($resource);
     }
     // Check if the user, resource and/or permission is denied
     if (isset($this->denied[$user->getName()])) {
         if (count($this->denied[$user->getName()]) > 0) {
             if (null !== $resource && array_key_exists($resource, $this->denied[$user->getName()])) {
                 if (count($this->denied[$user->getName()][$resource]) > 0) {
                     if (null !== $permission && in_array($permission, $this->denied[$user->getName()][$resource])) {
                         $result = true;
                     }
                 } else {
                     $result = true;
                 }
             }
         } else {
             $result = true;
         }
     }
     return $result;
 }