function nodeaccess_access in Nodeaccess 6
Same name and namespace in other branches
- 5 nodeaccess.module \nodeaccess_access()
- 6.2 nodeaccess.module \nodeaccess_access()
- 7 nodeaccess.module \nodeaccess_access()
Implementation of hook_access().
1 string reference to 'nodeaccess_access'
- nodeaccess_menu in ./
nodeaccess.module - Implementation of hook_menu().
File
- ./
nodeaccess.module, line 77
Code
function nodeaccess_access($op, $node, $account = NULL) {
global $user;
if (!$node) {
return FALSE;
}
// If no user object is supplied, the access check is for the current user.
if (empty($account)) {
$account = $user;
}
$allowed_types = variable_get('nodeaccess-types', array());
if ($op == 'grant') {
if ($node->nid && $allowed_types[$node->type] && (user_access('grant node permissions', $account) || user_access('grant editable node permissions', $account) && node_access('update', $node, $account) || user_access('grant deletable node permissions', $account) && node_access('delete', $node, $account) || user_access('grant own node permissions', $account) && $account->uid == $node->uid)) {
return TRUE;
}
}
return FALSE;
}