function og_access_node_grants in Organic groups 5
Same name and namespace in other branches
- 5.8 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()
- 7 og_access/og_access.module \og_access_node_grants()
Implementation of hook_node_grants().
File
- ./
og_access.module, line 177
Code
function og_access_node_grants($account, $op) {
if ($op == 'view') {
$grants['og_public'][] = 0;
// everyone can see a public node
}
// Subscribers get an admin or non-admin grant for each subscription
if ($subscriptions = og_get_subscriptions($account->uid)) {
foreach ($subscriptions as $key => $val) {
// Admins don't need to receive the subscriber grant since they can perform all operations.
if ($val['is_admin']) {
$grants['og_admin'][] = $key;
}
else {
$grants['og_subscriber'][] = $key;
}
}
}
return isset($grants) ? $grants : array();
}