You are here

function content_access_node_grants in Content Access 8

Same name and namespace in other branches
  1. 5 content_access.module \content_access_node_grants()
  2. 6 content_access.module \content_access_node_grants()
  3. 7 content_access.module \content_access_node_grants()

Implements hook_node_grants().

File

./content_access.module, line 64
Content access module file.

Code

function content_access_node_grants(AccountInterface $account, $op) {
  $gids = [];
  $roles = $account
    ->getRoles();
  foreach ($roles as $role) {
    $gids[] = content_access_get_role_gid($role);
  }
  return [
    'content_access_author' => [
      $account
        ->id(),
    ],
    'content_access_roles' => $gids,
  ];
}