can() public method

Determine if current user can access the given action and resource
public can ( $action, $resource, $resourceValue = null ) : boolean
return boolean
Example #1
0
 /**
  * Determines whether or not a consumer can view a resource.
  *
  * @param $rule
  * @param $resource
  * @return bool
  */
 private function can($rule, $resource)
 {
     // Guest access allowed
     if ('guest' == $rule) {
         return $this->permit();
     }
     if ($this->authority->can($rule, $resource)) {
         return $this->permit();
     }
     return false;
 }