function hosting_task_cancel_access in Hosting 6.2
Same name and namespace in other branches
- 7.4 task/hosting_task.module \hosting_task_cancel_access()
- 7.3 task/hosting_task.module \hosting_task_cancel_access()
1 string reference to 'hosting_task_cancel_access'
- hosting_task_menu in task/
hosting_task.module - Implementation of hook_menu().
File
- task/
hosting_task.module, line 107 - Web server node type is defined here.
Code
function hosting_task_cancel_access($node) {
// bring $user into scope, so we can test task ownership
global $user;
// To prevent CSRF attacks, a unique token based upon user is used. Deny
// access if the token is missing or invalid.
if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], $user->uid)) {
return FALSE;
}
// 'administer tasks' allows cancelling any and all tasks on the system
if (user_access('administer tasks')) {
return TRUE;
}
// 'cancel own tasks' allows cancelling any task the user *could have* created, on nodes she can view
if (user_access('cancel own tasks') && user_access('create ' . $node->task_type . ' task') && node_access('view', $node)) {
return TRUE;
}
}