function node_content_access in Drupal 5
Same name and namespace in other branches
- 6 modules/node/node.module \node_content_access()
Implementation of hook_access().
Related topics
File
- modules/
node/ node.module, line 3051 - The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.
Code
function node_content_access($op, $node) {
global $user;
$type = is_string($node) ? $node : (is_array($node) ? $node['type'] : $node->type);
if ($op == 'create') {
return user_access('create ' . $type . ' content');
}
if ($op == 'update' || $op == 'delete') {
if (user_access('edit ' . $type . ' content') || user_access('edit own ' . $type . ' content') && $user->uid == $node->uid) {
return TRUE;
}
}
}