Acl\Auth\CrudAuthorize::authorize PHP Method

authorize() public method

Authorize a user using the mapped actions and the AclComponent.
public authorize ( array $user, Cake\Network\Request $request ) : boolean
$user array The user to authorize
$request Cake\Network\Request The request needing authorization.
return boolean
    public function authorize($user, Request $request)
    {
        $mapped = $this->config('actionMap.' . $request->params['action']);
        if (!$mapped) {
            trigger_error(sprintf('CrudAuthorize::authorize() - Attempted access of un-mapped action "%1$s" in controller "%2$s"', $request->action, $request->controller), E_USER_WARNING);
            return false;
        }
        $user = [$this->_config['userModel'] => $user];
        $Acl = $this->_registry->load('Acl');
        return $Acl->check($user, $this->action($request, ':controller'), $mapped);
    }