original_string: public function isAuthorized($user = null, ServerRequest $request = null)
      {
          if (empty($user) && !$this->user()) {
              return false;
          }
          if (empty($user)) {
              $user = $this->user();
          }
          if (empty($request)) {
              $request = $this->getController()->getRequest();
          }
          if (empty($this->_authorizeObjects)) {
              $this->constructAuthorize();
          }
          foreach ($this->_authorizeObjects as $authorizer) {
              if ($authorizer->authorize($user, $request) === true) {
                  $this->_authorizationProvider = $authorizer;
  
                  return true;
              }
          }
  
          return false;
      }
code: public function isAuthorized($user = null, ServerRequest $request = null)
      {
          if (empty($user) && !$this->user()) {
              return false;
          }
          if (empty($user)) {
              $user = $this->user();
          }
          if (empty($request)) {
              $request = $this->getController()->getRequest();
          }
          if (empty($this->_authorizeObjects)) {
              $this->constructAuthorize();
          }
          foreach ($this->_authorizeObjects as $authorizer) {
              if ($authorizer->authorize($user, $request) === true) {
                  $this->_authorizationProvider = $authorizer;
  
                  return true;
              }
          }
  
          return false;
      }
code_tokens: public function isAuthorized ( $ user = null , ServerRequest $ request = null ) { if ( empty ( $ user ) && ! $ this -> user ( ) ) { return false ; } if ( empty ( $ user ) ) { $ user = $ this -> user ( ) ; } if ( empty ( $ request ) ) { $ request = $ this -> getController ( ) -> getRequest ( ) ; } if ( empty ( $ this -> _authorizeObjects ) ) { $ this -> constructAuthorize ( ) ; } foreach ( $ this -> _authorizeObjects as $ authorizer ) { if ( $ authorizer -> authorize ( $ user , $ request ) === true ) { $ this -> _authorizationProvider = $ authorizer ; return true ; } } return false ; }
docstring: Check if the provided user is authorized for the request.
  
  Uses the configured Authorization adapters to check whether or not a user is authorized.
  Each adapter will be checked in sequence, if any of them return true, then the user will
  be authorized for the request.
  
  @param array|\ArrayAccess|null $user The user to check the authorization of.
  If empty the user fetched from storage will be used.
  @param \Cake\Http\ServerRequest|null $request The request to authenticate for.
  If empty, the current request will be used.
  @return bool True if $user is authorized, otherwise false
docstring_tokens: Check if the provided user is authorized for the request .