public function authorize(RequestInterface $request)
    {
        if (!$area = $this->findMatchingArea($request)) {
            return $this;
        }

        if (!$this->user) {
            throw new AuthorizationException(sprintf('Access denied to area "%s". No authenticated user', $area->pattern()));
        }

        if (!$area->authorize($this->user, $request->clientIp())) {
            throw new AuthorizationException(sprintf('Access denied to area "%s". Authenticated user does not have access', $area->pattern()));
        }

        return $this;
    }
public function authorize(RequestInterface $request)
    {
        if (!$area = $this->findMatchingArea($request)) {
            return $this;
        }

        if (!$this->user) {
            throw new AuthorizationException(sprintf('Access denied to area "%s". No authenticated user', $area->pattern()));
        }

        if (!$area->authorize($this->user, $request->clientIp())) {
            throw new AuthorizationException(sprintf('Access denied to area "%s". Authenticated user does not have access', $area->pattern()));
        }

        return $this;
    }
public function authorize ( RequestInterface $ request ) { if ( ! $ area = $ this -> findMatchingArea ( $ request ) ) { return $ this ; } if ( ! $ this -> user ) { throw new AuthorizationException ( sprintf ( 'Access denied to area "%s". No authenticated user' , $ area -> pattern ( ) ) ) ; } if ( ! $ area -> authorize ( $ this -> user , $ request -> clientIp ( ) ) ) { throw new AuthorizationException ( sprintf ( 'Access denied to area "%s". Authenticated user does not have access' , $ area -> pattern ( ) ) ) ; } return $ this ; }
Checks if authenticated user has access to requested area

@param RequestInterface $request

@return $this
@throws AuthorizationException
Checks if authenticated user has access to requested area