Acl\Controller\Component\AclComponent::check PHP Method

check() public method

Pass-thru function for ACL check instance. Check methods are used to check whether or not an ARO can access an ACO
public check ( array | string | Model $aro, array | string | Model $aco, string $action = "*" ) : boolean
$aro array | string | Model ARO The requesting object identifier. See `AclNode::node()` for possible formats
$aco array | string | Model ACO The controlled object identifier. See `AclNode::node()` for possible formats
$action string Action (defaults to *)
return boolean Success
    public function check($aro, $aco, $action = "*")
    {
        return $this->_Instance->check($aro, $aco, $action);
    }

Usage Example

Example #1
0
 /**
  * Check permission for a given ARO to a given ACO.
  *
  * @return void
  */
 public function check()
 {
     extract($this->_getParams());
     if ($this->Acl->check($aro, $aco, $action)) {
         $this->out(__d('cake_acl', '{0} is <success>allowed</success>.', [$aroName]));
     } else {
         $this->out(__d('cake_acl', '{0} is <error>not allowed</error>.', [$aroName]));
     }
 }