From 66c50098c908bd362f8d2b9d141ea609dca54cf6 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 29 Sep 2010 14:08:54 +0000 Subject: - Patch #920614 by agentrickard, chx, Damien Tournoud: unpublished content visible when a Node Access module is enabled. --- modules/node/node.module | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/node/node.module') diff --git a/modules/node/node.module b/modules/node/node.module index b491e7469..a572d494b 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -3156,8 +3156,8 @@ function node_access_acquire_grants($node, $delete = TRUE) { $grants = module_invoke_all('node_access_records', $node); // Let modules alter the grants. drupal_alter('node_access_records', $grants, $node); - // If no grants are set, then use the default grant. - if (empty($grants)) { + // If no grants are set and the node is published, then use the default grant. + if (empty($grants) && !empty($node->status)) { $grants[] = array('realm' => 'all', 'gid' => 0, 'grant_view' => 1, 'grant_update' => 0, 'grant_delete' => 0); } else { @@ -3206,7 +3206,7 @@ function node_access_write_grants($node, $grants, $realm = NULL, $delete = TRUE) } // Only perform work when node_access modules are active. - if (count(module_implements('node_grants'))) { + if (!empty($grants) && count(module_implements('node_grants'))) { $query = db_insert('node_access')->fields(array('nid', 'realm', 'gid', 'grant_view', 'grant_update', 'grant_delete')); foreach ($grants as $grant) { if ($realm && $realm != $grant['realm']) { -- cgit v1.2.3