You are here

function clone_access_cloning in Node clone 6

Same name and namespace in other branches
  1. 5.2 clone.module \clone_access_cloning()
  2. 5 clone.module \clone_access_cloning()
  3. 7 clone.module \clone_access_cloning()
1 call to clone_access_cloning()
views_handler_field_node_link_clone::render in views/views_handler_field_node_link_clone.inc
1 string reference to 'clone_access_cloning'
clone_menu in ./clone.module
Implementation of hook_menu().

File

./clone.module, line 56
Allow users to make a copy of an item of content (a node) and then edit that copy.

Code

function clone_access_cloning($node) {
  global $user;

  // Check basic permissions first.
  $access = clone_is_permitted($node->type) && (user_access('clone node') || $user->uid && $node->uid == $user->uid && user_access('clone own nodes'));

  // Check additional conditions
  $access = $access && (filter_access($node->format) && node_access('create', $node->type));

  // Make sure the user can view the original node content.
  $access = $access && node_access('view', $node);

  // Let other modules alter access.
  drupal_alter("clone_access", $access, $node);
  return $access;
}