bundle/EventListener/RequestListener.php
public function onKernelRequest(GetResponseEvent $event)
    {
        if ($event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST) {
            return;
        }

        $requestAttributes = $event->getRequest()->attributes;

        $currentSiteAccess = $requestAttributes->get('siteaccess');
        $allowedSiteAccesses = $requestAttributes->get(self::ALLOWED_SITEACCESSES_KEY);

        // We allow the route if no current siteaccess is set or
        // no allowed siteaccesses (meaning all are allowed) are defined
        if (!$currentSiteAccess instanceof SiteAccess || empty($allowedSiteAccesses)) {
            return;
        }

        if (!is_array($allowedSiteAccesses)) {
            $allowedSiteAccesses = array($allowedSiteAccesses);
        }

        if ($this->matcher->isAllowed($currentSiteAccess->name, $allowedSiteAccesses)) {
            return;
        }

        throw new NotFoundHttpException('Route is not allowed in current siteaccess');
    }
public function onKernelRequest(GetResponseEvent $event)
    {
        if ($event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST) {
            return;
        }

        $requestAttributes = $event->getRequest()->attributes;

        $currentSiteAccess = $requestAttributes->get('siteaccess');
        $allowedSiteAccesses = $requestAttributes->get(self::ALLOWED_SITEACCESSES_KEY);

        // We allow the route if no current siteaccess is set or
        // no allowed siteaccesses (meaning all are allowed) are defined
        if (!$currentSiteAccess instanceof SiteAccess || empty($allowedSiteAccesses)) {
            return;
        }

        if (!is_array($allowedSiteAccesses)) {
            $allowedSiteAccesses = array($allowedSiteAccesses);
        }

        if ($this->matcher->isAllowed($currentSiteAccess->name, $allowedSiteAccesses)) {
            return;
        }

        throw new NotFoundHttpException('Route is not allowed in current siteaccess');
    }
public function onKernelRequest ( GetResponseEvent $ event ) { if ( $ event -> getRequestType ( ) !== HttpKernelInterface :: MASTER_REQUEST ) { return ; } $ requestAttributes = $ event -> getRequest ( ) -> attributes ; $ currentSiteAccess = $ requestAttributes -> get ( 'siteaccess' ) ; $ allowedSiteAccesses = $ requestAttributes -> get ( self :: ALLOWED_SITEACCESSES_KEY ) ; // We allow the route if no current siteaccess is set or // no allowed siteaccesses (meaning all are allowed) are defined if ( ! $ currentSiteAccess instanceof SiteAccess || empty ( $ allowedSiteAccesses ) ) { return ; } if ( ! is_array ( $ allowedSiteAccesses ) ) { $ allowedSiteAccesses = array ( $ allowedSiteAccesses ) ; } if ( $ this -> matcher -> isAllowed ( $ currentSiteAccess -> name , $ allowedSiteAccesses ) ) { return ; } throw new NotFoundHttpException ( 'Route is not allowed in current siteaccess' ) ; }
Throws an exception if current route is not allowed in current siteaccess.

@param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
Throws an exception if current route is not allowed in current siteaccess .