Can I use KernelEvents::EXCEPTION to make exceptions for my own code?

by yogurtexpress   Last Updated October 18, 2019 18:07 PM - source

I've written code for a custom module in my .MODULE file that looks like this.

function cookie_authentication_node_access(NodeInterface $node, $op, AccountInterface $account) {
  if ($account->isAnonymous() && $node->gettype() == 'page') {
    return AccessResult::forbidden()->cachePerPermissions();
  }

return AccessResult::neutral(); 

}

Basically, using an EventSubscriber, I want to create an exception for my own rule I made above (letting anonymous users access a certain page)...

Would the 'EXCEPTION' KernelEvent be the right path, or is it only for real uncaught exceptions?

Tags : redirection


Related Questions





Delete single redirection

Updated June 07, 2019 16:07 PM