function node_view_permissions_node_grants in Node View Permissions 7
Same name and namespace in other branches
- 8 node_view_permissions.module \node_view_permissions_node_grants()
Implements hook_node_grants().
File
- ./
node_view_permissions.module, line 86
Code
function node_view_permissions_node_grants($account, $op) {
$grants = array();
if ($op == 'view' && !empty($configure_types = node_view_permissions_get_configured_types())) {
foreach ($configure_types as $type) {
if (user_access('view any ' . $type . ' content', $account)) {
$grants['view_any_' . $type . '_content'] = array(
1,
);
}
if (user_access('view own ' . $type . ' content', $account)) {
$grants['view_own_' . $type . '_content'] = array(
$account->uid,
);
}
}
}
return $grants;
}