private function KernelEventListener::handleAccessToNodePages in Permissions by Term 8.2
1 call to KernelEventListener::handleAccessToNodePages()
- KernelEventListener::onKernelRequest in src/
Listener/ KernelEventListener.php - Access restriction on kernel request.
File
- src/
Listener/ KernelEventListener.php, line 167
Class
- KernelEventListener
- Class KernelEventListener.
Namespace
Drupal\permissions_by_term\ListenerCode
private function handleAccessToNodePages(GetResponseEvent $event) {
// Restricts access to nodes (views/edit).
if ($this
->canRequestGetNode($event
->getRequest())) {
$node = $event
->getRequest()->attributes
->get('node');
if (!$this->accessCheckService
->canUserAccessByNode($node, false, $this->accessStorageService
->getLangCode($node
->id()))) {
$accessDeniedEvent = new PermissionsByTermDeniedEvent($node
->id());
$this->eventDispatcher
->dispatch(PermissionsByTermDeniedEvent::NAME, $accessDeniedEvent);
if ($this->disabledNodeAccessRecords) {
$this->pageCacheKillSwitch
->trigger();
}
throw new AccessDeniedHttpException();
}
}
}