summaryrefslogtreecommitdiff
path: root/modules/node/node.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-09-29 14:08:54 +0000
committerDries Buytaert <dries@buytaert.net>2010-09-29 14:08:54 +0000
commit66c50098c908bd362f8d2b9d141ea609dca54cf6 (patch)
treef85d34a697463cb0b1f0120b6a24bbcc65c14426 /modules/node/node.module
parent3762f4bbc9ae23eb54eb2757c4818327297544ce (diff)
downloadbrdo-66c50098c908bd362f8d2b9d141ea609dca54cf6.tar.gz
brdo-66c50098c908bd362f8d2b9d141ea609dca54cf6.tar.bz2
- Patch #920614 by agentrickard, chx, Damien Tournoud: unpublished content visible when a Node Access module is enabled.
Diffstat (limited to 'modules/node/node.module')
-rw-r--r--modules/node/node.module6
1 files changed, 3 insertions, 3 deletions
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']) {