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

allow() public method

Pass-thru function for ACL allow instance. Allow methods are used to grant an ARO access to an ACO.
public allow ( 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 allow($aro, $aco, $action = "*")
    {
        return $this->_Instance->allow($aro, $aco, $action);
    }

Usage Example

Example #1
0
 /**
  * Grant permission for a given ARO to a given ACO.
  *
  * @return void
  */
 public function grant()
 {
     extract($this->_getParams());
     if ($this->Acl->allow($aro, $aco, $action)) {
         $this->out(__d('cake_acl', 'Permission <success>granted</success>.'));
     } else {
         $this->out(__d('cake_acl', 'Permission was <error>not granted</error>.'));
     }
 }