You are here

function permissions_by_term_node_grants in Permissions by Term 8

Same name and namespace in other branches
  1. 8.2 permissions_by_term.module \permissions_by_term_node_grants()

Implements hook_node_grants().

File

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

Code

function permissions_by_term_node_grants(\Drupal\Core\Session\AccountInterface $account, $op) {
  if ($op == 'view') {

    /**
     * @var \Drupal\permissions_by_term\Service\AccessStorage $accessStorage
     */
    $accessStorage = \Drupal::service('permissions_by_term.access_storage');
    $grants = $accessStorage
      ->getGids(\Drupal::currentUser());
    return $grants;
  }
}