public function LegacyAccessSubscriber::onKernelRequestAccessCheck

Verifies that the current user can access the requested path.

@todo This is a total hack to keep our current access system working. It should be replaced with something robust and injected at some point.

Parameters

Symfony\Component\HttpKernel\Event\GetResponseEvent $event: The Event to process.

File

drupal/core/lib/Drupal/Core/EventSubscriber/LegacyAccessSubscriber.php, line 29
Contains Drupal\Core\EventSubscriber\LegacyAccessSubscriber.

Class

LegacyAccessSubscriber
Access subscriber for legacy controller requests.

Namespace

Drupal\Core\EventSubscriber

Code

public function onKernelRequestAccessCheck(GetResponseEvent $event) {
  $router_item = $event
    ->getRequest()->attributes
    ->get('drupal_menu_item');
  if (isset($router_item['access']) && !$router_item['access']) {
    throw new AccessDeniedHttpException();
  }
}