function hosting_server_node_access in Hosting 7.4
Same name and namespace in other branches
- 7.3 server/hosting_server.module \hosting_server_node_access()
Implements hook_node_access().
File
- server/
hosting_server.module, line 175
Code
function hosting_server_node_access($node, $op, $account) {
if (variable_get('hosting_server_use_hosting_client_access', TRUE) && hosting_feature('client') && $op != 'create') {
// We rely on hosting_client_node_grants() instead of global configuration.
return NODE_ACCESS_IGNORE;
}
$type = is_string($node) ? $node : $node->type;
if ($type != 'server') {
return NODE_ACCESS_IGNORE;
}
// Permission "administer servers" allows all ops.
if (user_access('administer servers', $account)) {
return 'allow';
}
switch ($op) {
case 'create':
return user_access('create server', $account) ? NODE_ACCESS_ALLOW : NODE_ACCESS_DENY;
case 'update':
return user_access('edit server', $account) ? NODE_ACCESS_ALLOW : NODE_ACCESS_DENY;
case 'delete':
return user_access('delete server', $account) ? NODE_ACCESS_ALLOW : NODE_ACCESS_DENY;
case 'view':
return user_access('view server', $account) ? NODE_ACCESS_ALLOW : NODE_ACCESS_DENY;
}
}