diff -rupN original/nodeaccess.module modified/nodeaccess.module
--- original/nodeaccess.module 2009-03-07 19:00:45.000000000 -0500
+++ modified/nodeaccess.module 2009-08-05 13:00:33.000000000 -0400
@@ -53,6 +53,7 @@ function nodeaccess_access($op, $node, $
if (empty($account)) {
$account = $user;
}
+
$allowed_types = variable_get('nodeaccess-types', array());
if ($op == 'grant') {
if ($node->nid && $allowed_types[$node->type] &&
@@ -99,12 +100,18 @@ function nodeaccess_admin_form(&$form_st
'#default_value' => variable_get('nodeaccess-priority', 0),
'#description' => '' . t('If you are only using this access control module, you can safely ignore this. If you are using multiple access control modules, and you want the grants given on individual nodes to override any grants given by other modules, you should check this box.') . '');
+
// Select whether to preserve hidden grants.
$form['preserve'] = array('#type' => 'checkbox',
'#title' => t('Preserve hidden grants'),
'#default_value' => variable_get('nodeaccess-preserve', 1),
'#description' => '' . t('If you check this box, any hidden grants are preserved when you save grants. Otherwise all grants users are not allowed to view or edit are revoked on save.') . '');
+ $form['defclean'] = array('#type' => 'checkbox',
+ '#title' => t('Default behavior: no access control'),
+ '#default_value' => variable_get('nodeaccess-defclean', 1),
+ '#description' => '' . t('If this option is turned on, default ACL is to not check ACL at all. This allows to preserve OG compatibility, and disables any ACL management for node with no grants.') . '');
+
// Select permissions you want to allow users to view and edit.
$form['grant'] = array('#type' => 'fieldset',
'#collapsible' => TRUE,
@@ -681,7 +688,12 @@ function nodeaccess_node_access_records(
// Load priority setting.
$priority = variable_get('nodeaccess-priority', 0);
$result = db_result(db_query("SELECT count(*) FROM {nodeaccess} WHERE nid = %d", $node->nid));
+
if ($result < 1) {
+ $defclean = variable_get('nodeaccess-defclean', 1);
+ if ( $defclean == 1) {
+ return NULL; // hack to disable nodeaccess grants if there's no grants defined
+ }
// Node has no own grants, use defaults.
$grants = $default;
foreach ($grants as $id => $grant) {