From c362ae539a7fdd03d8d182b0bca467fda1b201c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Tue, 26 Jun 2007 22:27:25 +0000 Subject: #153998 by pwolanin: separate edit a delete permissions, so people who can edit a node cannot delete it too automatically --- modules/node/node.module | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'modules/node/node.module') diff --git a/modules/node/node.module b/modules/node/node.module index 892ed6f30..246ff6c2f 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -849,6 +849,8 @@ function node_perm() { if ($type->module == 'node') { $name = check_plain($type->type); $perms[] = 'create '. $name .' content'; + $perms[] = 'delete own '. $name .' content'; + $perms[] = 'delete '. $name .' content'; $perms[] = 'edit own '. $name .' content'; $perms[] = 'edit '. $name .' content'; } @@ -3084,11 +3086,17 @@ function node_content_access($op, $node) { return user_access('create '. $type .' content'); } - if ($op == 'update' || $op == 'delete') { + if ($op == 'update') { if (user_access('edit '. $type .' content') || (user_access('edit own '. $type .' content') && ($user->uid == $node->uid))) { return TRUE; } } + + if ($op == 'delete') { + if (user_access('delete '. $type .' content') || (user_access('delete own '. $type .' content') && ($user->uid == $node->uid))) { + return TRUE; + } + } } /** -- cgit v1.2.3