You are here

function clone_access_cloning in Node clone 5.2

Same name and namespace in other branches
  1. 5 clone.module \clone_access_cloning()
  2. 6 clone.module \clone_access_cloning()
  3. 7 clone.module \clone_access_cloning()
1 call to clone_access_cloning()
clone_menu in ./clone.module
Implementation of hook_menu().

File

./clone.module, line 56

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 this - for exmple to only allow some users
  // to clone specific nodes or types.
  foreach (module_implements('clone_access_alter') as $module) {
    $function = $module . '_clone_access_alter';
    $function($access, $node);
  }
  return $access;
}