function og_access_node_grants in Organic groups 7
Same name and namespace in other branches
- 5.8 og_access.module \og_access_node_grants()
- 5 og_access.module \og_access_node_grants()
- 5.3 og_access.module \og_access_node_grants()
- 5.7 og_access.module \og_access_node_grants()
- 6.2 modules/og_access/og_access.module \og_access_node_grants()
- 6 modules/og_access/og_access.module \og_access_node_grants()
- 7.2 og_access/og_access.module \og_access_node_grants()
Implements hook_node_grants().
File
- og_access/
og_access.module, line 43 - Enable access control for private and public groups and group content.
Code
function og_access_node_grants($account, $op) {
$grants = array();
if ($op == 'view' && ($groups = og_get_entity_groups('user', $account))) {
foreach ($groups as $gid => $value) {
// Not all the groups are nodes, but in order to save loading the groups
// we grant all group IDs.
$grants[OG_ACCESS_AUTHENTICATED_REALM][] = $gid;
}
}
return $grants;
}