Error message
You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).function node_node_access
Same name and namespace in other branches
- 10 core/modules/node/node.module \node_node_access()
- 9 core/modules/node/node.module \node_node_access()
- 8.9.x core/modules/node/node.module \node_node_access()
Implements hook_node_access().
Related topics
- Node access rights
- The node access system determines who can do what to which nodes.
File
-
modules/
node/ node.module, line 3109
Code
function node_node_access ($node, $op, $account) {
$type = is_string ($node) ? $node : $node->type ;
if (in_array ($type, node_permissions_get_configured_types ())) {
if ($op == 'create' && user_access ('create ' . $type . ' content', $account)) {
return NODE_ACCESS_ALLOW ;
}
if ($op == 'update') {
if (user_access ('edit any ' . $type . ' content', $account) || user_access ('edit own ' . $type . ' content', $account) && $account->uid == $node->uid) {
return NODE_ACCESS_ALLOW ;
}
}
if ($op == 'delete') {
if (user_access ('delete any ' . $type . ' content', $account) || user_access ('delete own ' . $type . ' content', $account) && $account->uid == $node->uid) {
return NODE_ACCESS_ALLOW ;
}
}
}
return NODE_ACCESS_IGNORE ;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.