function hosting_client_access in Hostmaster (Aegir) 6
Implementation of hook_access().
File
- modules/
hosting/ client/ hosting_client.module, line 61
Code
function hosting_client_access($op, $node, $account) {
if (!hosting_feature('client')) {
// multiple client support has been disabled for this site.
return FALSE;
}
if (user_access('administer clients', $account)) {
return TRUE;
}
else {
switch ($op) {
case 'create':
return user_access('create client', $account);
break;
case 'view':
return user_access('view client', $account) && db_fetch_array(db_query("SELECT user FROM {hosting_client_user} WHERE user=%d and client=%d", $account->uid, $node->nid));
case 'update':
if (user_access('edit own client', $account) && $account->uid == $node->uid) {
return TRUE;
}
break;
case 'delete':
if (user_access('delete own client', $account) && $account->uid == $node->uid) {
return TRUE;
}
break;
default:
break;
}
}
}