You are here

function basic_cart_node_access in Basic cart 8.6

Implements hook_node_access().

File

./basic_cart.module, line 391
Basic cart module file.

Code

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

  // Restrict access to view of order by permission.
  if ($op === 'view' && $node
    ->bundle() === Utility::BASICCART_ORDER) {
    return AccessResult::forbiddenIf(!$account
      ->hasPermission('basic_cart view_orders'))
      ->addCacheContexts([
      'user.permissions',
    ]);
  }
  return AccessResult::neutral();
}