You are here

function permissions_by_term_node_access in Permissions by Term 8.2

Same name and namespace in other branches
  1. 8 permissions_by_term.module \permissions_by_term_node_access()
  2. 7 permissions_by_term.module \permissions_by_term_node_access()

Implements hook_node_access().

Forwards user by drupal_access_denied(); to an access denied page, if a single restricted node is called.

This hook is not fired if admin is logged in. Users with the "bypass node access" permission may always view and edit content through the administrative interface.

File

./permissions_by_term.module, line 402
Allows access to terms in a vocabulary to be limited by user or role.

Code

function permissions_by_term_node_access(NodeInterface $node, $op, AccountInterface $account) {

  /* @var \Drupal\permissions_by_term\Service\AccessCheck $accessCheck */
  $accessCheck = \Drupal::service('permissions_by_term.access_check');
  $accessCheck
    ->dispatchDeniedEventOnRestricedAccess($node, $node
    ->language()
    ->getId());
}