Index: clone.module =================================================================== --- clone.module (revision 689) +++ clone.module (working copy) @@ -23,7 +23,12 @@ * Implementation of hook_perm(). */ function clone_perm() { - return array('clone node', 'clone own nodes'); + $perms = array('clone node', 'clone own nodes'); + if (variable_get('clone_per_content_type_perms', FALSE)) foreach (node_get_types() as $type) { + $name = check_plain($type->type); + $perms[] = "clone {$name} nodes"; + } + return $perms; } /** @@ -54,7 +59,11 @@ function clone_access($node) { global $user; // Check basic permissions first. - $access = (user_access('clone node') || ($user->uid && ($node->uid == $user->uid) && user_access('clone own nodes'))); + $type = check_plain($node->type); + $access = ( + user_access('clone node') || + ($user->uid && ($node->uid == $user->uid) && user_access('clone own nodes')) || + (variable_get('clone_per_content_type_perms', FALSE) && user_access("clone {$type} nodes"))); // Make sure the user can view the original node content. $access = $access && node_access('view', $node); // Check additional conditions Index: clone.install =================================================================== --- clone.install (revision 689) +++ clone.install (working copy) @@ -6,7 +6,7 @@ * Implementation of hook_uninstall. */ function clone_uninstall() { - + variable_del('clone_per_content_type_perms'); variable_del('clone_method'); variable_del('clone_omitted'); variable_del('clone_nodes_without_confirm'); Index: clone.pages.inc =================================================================== --- clone.pages.inc (revision 689) +++ clone.pages.inc (working copy) @@ -50,6 +50,17 @@ '#options' => $types, '#description' => t('Select any node types which should never be cloned. Typically you should will want to select here all node types for which cloning fails (e.g. image nodes).'), ); + // Allow setting permssions per content type + $form['perms'] = array( + '#type' => 'fieldset', + '#title' => t('Permissions'), + ); + $form['perms']['clone_per_content_type_perms'] = array( + '#type' => 'checkbox', + '#title' => t('Apply permissions per content type'), + '#default_value' => variable_get('clone_per_content_type_perms', FALSE), + '#description' => t('Switch on if you wish to assign clone permissions on a per-content-type basis.'), + ); return system_settings_form($form); }