You are here

function nodeaccess_access in Nodeaccess 5

Same name and namespace in other branches
  1. 6.2 nodeaccess.module \nodeaccess_access()
  2. 6 nodeaccess.module \nodeaccess_access()
  3. 7 nodeaccess.module \nodeaccess_access()

Implementation of hook_access().

1 call to nodeaccess_access()
nodeaccess_menu in ./nodeaccess.module
Implementation of hook_menu().

File

./nodeaccess.module, line 51

Code

function nodeaccess_access($op, $node) {
  global $user;
  $allowed_types = variable_get('nodeaccess-types', array());
  if ($op == 'grant') {
    if ($node->nid && $allowed_types[$node->type] && (user_access('grant node permissions') || user_access('grant editable node permissions') && node_access('update', $node) || user_access('grant deletable node permissions') && node_access('delete', $node) || user_access('grant own node permissions') && $user->uid == $node->uid)) {
      return TRUE;
    }
  }
  return FALSE;
}