Skip to content

Instantly share code, notes, and snippets.

@ahebrank
Created November 27, 2018 18:33
Show Gist options
  • Select an option

  • Save ahebrank/c2705e4dda201d66a3fd7436a291ebc8 to your computer and use it in GitHub Desktop.

Select an option

Save ahebrank/c2705e4dda201d66a3fd7436a291ebc8 to your computer and use it in GitHub Desktop.
diff --git a/quick_node_clone.module b/quick_node_clone.module
index 722075d..a89a1d9 100644
--- a/quick_node_clone.module
+++ b/quick_node_clone.module
@@ -58,14 +58,6 @@ function _quick_node_clone_has_clone_permission($bundle) {
throw new InvalidArgumentException('Argument 1 passed to _quick_node_clone_has_clone_permission() must be of type string, ' . gettype($bundle) . ' given.');
}
$current_user = \Drupal::currentUser();
- if ($current_user->hasPermission("administer nodes")) {
- return TRUE;
- }
- if ($current_user->hasPermission("bypass node access")) {
- return TRUE;
- }
- if ($current_user->hasPermission("clone $bundle content") && $current_user->hasPermission("create $bundle content")) {
- return TRUE;
- }
- return FALSE;
+ return ($current_user->hasPermission("clone $bundle content")
+ && ($current_user->hasPermission("create $bundle content") || $current_user->hasPermission("administer nodes") || $current_user->hasPermission("bypass node access")));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment