function hosting_client_node_grants in Hosting 6.2
Same name and namespace in other branches
- 7.4 client/hosting_client.access.inc \hosting_client_node_grants()
- 7.3 client/hosting_client.access.inc \hosting_client_node_grants()
Implements hook_node_grants().
File
- client/
hosting_client.access.inc, line 171 - Control client node access.
Code
function hosting_client_node_grants($account, $op) {
$account->client_id = hosting_get_client_from_user($account->uid);
$types = hosting_feature_node_types();
foreach ($types as $type) {
if (user_access('administer ' . $type . 's', $account)) {
$grants['hosting ' . $type] = array(
1,
);
}
elseif (user_access($op . ' ' . $type, $account)) {
// TODO: restrict access to certain op-type based on the user relationship to this client - see content of $client_relations
$grants['hosting ' . $type] = array_keys($account->client_id);
}
elseif ($op == 'update' && user_access('edit ' . $type, $account)) {
$grants['hosting ' . $type] = array_keys($account->client_id);
}
}
return $grants;
}