Skip to content
Snippets Groups Projects
Commit 2ab021a0 authored by Steven Ayers's avatar Steven Ayers
Browse files

Issue #3026139 by bluegeek9, adityasingh, liakoni, vasyl manachynskyi: Need...

Issue #3026139 by bluegeek9, adityasingh, liakoni, vasyl manachynskyi: Need permission to only clone own nodes
parent aa3304d2
No related branches found
No related tags found
1 merge request!47Issue #3026139 by bluegeek9: Need permission to only clone own nodes
Pipeline #428342 passed with warnings
......@@ -111,7 +111,15 @@ function quick_node_clone_node_access(NodeInterface $node, $operation, AccountIn
}
$bundle = $node->bundle();
if (!$account->hasPermission("clone $bundle content")) {
$permissions = ["clone $bundle content"];
$is_owner = $node->getOwnerId() == $account->id();
if ($is_owner) {
$permissions[] = "clone own $bundle content";
}
$access = AccessResult::allowedIfHasPermissions($account, $permissions, 'OR');
if (!$access->isAllowed()) {
return AccessResult::neutral();
}
......
......@@ -42,6 +42,9 @@ class QuickNodeClonePermissions {
"clone $type_id content" => [
'title' => $this->t('%type_name: clone contents', $type_params),
],
"clone own $type_id content" => [
'title' => $this->t('%type_name: clone own content', $type_params),
],
];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment