You are here

function node_content_access in Drupal 6

Same name and namespace in other branches
  1. 5 modules/node/node.module \node_content_access()

Implementation of hook_access().

Named so as not to conflict with node_access()

Related topics

File

modules/node/node.module, line 2437
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, $account) {
  $type = is_string($node) ? $node : (is_array($node) ? $node['type'] : $node->type);
  if ($op == 'create') {
    return user_access('create ' . $type . ' content', $account);
  }
  if ($op == 'update') {
    if (user_access('edit any ' . $type . ' content', $account) || user_access('edit own ' . $type . ' content', $account) && $account->uid == $node->uid) {
      return TRUE;
    }
  }
  if ($op == 'delete') {
    if (user_access('delete any ' . $type . ' content', $account) || user_access('delete own ' . $type . ' content', $account) && $account->uid == $node->uid) {
      return TRUE;
    }
  }
}