You are here

function og_subgroups_node_grants in Subgroups for Organic groups 7.2

Implements hook_node_grants().

File

./og_subgroups.module, line 122
Provides users the ability to inherit permissions on subgroups.

Code

function og_subgroups_node_grants($account, $op) {
  if ($op != 'view' || !module_exists('og_access')) {
    return;
  }
  $grants = array();
  $groups = og_subgroup_user_groups_load($account);
  if (!empty($groups)) {
    foreach ($groups as $group_type => $gids) {
      $grants[OG_ACCESS_REALM . ':' . $group_type] = $gids;
    }
  }
  return $grants;
}