multiple_node_access.patch no longer applies cleanly for Drupal 6.14.
Here's /path/to/drupal/modules/node/node.module.rej:

*************** function node_access($op, $node, $accoun
*** 2032,2053 ****
  
    // If the module did not override the access rights, use those set in the
    // node_access table.
-   if ($op != 'create' && $node->nid && $node->status) {
-     $grants = array();
-     foreach (node_access_grants($op, $account) as $realm => $gids) {
-       foreach ($gids as $gid) {
-         $grants[] = "(gid = $gid AND realm = '$realm')";
        }
      }
- 
-     $grants_sql = '';
-     if (count($grants)) {
-       $grants_sql = 'AND ('. implode(' OR ', $grants) .')';
-     }
- 
-     $sql = "SELECT COUNT(*) FROM {node_access} WHERE (nid = 0 OR nid = %d) $grants_sql AND grant_$op >= 1";
-     $result = db_query($sql, $node->nid);
-     return (db_result($result));
    }
  
    // Let authors view their own nodes.
--- 2032,2050 ----
  
    // If the module did not override the access rights, use those set in the
    // node_access table.
+   if ($op != 'create' && $node->nid) {
+     $grants_sql = node_access_grants_sql($op, NULL, $account, $node->status);
+     // If the return value is FALSE, then the node status is unpublished and
+     // none of the grants requested an access check be run. In which case,
+     // we should fall through to the final 'if' statement.
+     if ($grants_sql !== FALSE) {
+       if (!empty($grants_sql)) {
+         $grants_sql .= ' AND';
        }
+       $sql = "SELECT COUNT(*) FROM {node_access} WHERE (nid = 0 OR nid = %d) $grants_sql grant_$op >= 1";
+       $result = db_query($sql, $node->nid);
+       return (db_result($result));
      }
    }
  
    // Let authors view their own nodes.

Comments

ken54671’s picture

Status: Active » Patch (to be ported)
StatusFileSize
new6.41 KB
ken54671’s picture

StatusFileSize
new6.4 KB

Removing extraneous AND

<?php
      $sql = "SELECT 1 FROM {node_access} WHERE (nid = 0 OR nid = %d) $grants_sql grant_$op >= 1";
      $result = db_query_range($sql, $node->nid, 0, 1);
      return (bool) db_result($result);
?>
matteoraggi’s picture

this patch is needed only for .dev or also for .rc9 version of domain access module?

agentrickard’s picture

Category: bug » task
Status: Patch (to be ported) » Needs work

The patch needs to apply to HEAD (6.x.2-dev), so it can be released.

ken54671’s picture

StatusFileSize
new11.14 KB

Patch for HEAD.

agentrickard’s picture

Status: Needs work » Needs review

I love it when we have patches of patches.

ken54671’s picture

StatusFileSize
new1.25 KB

Re-roll of the patch in #5. Patch for HEAD.

andrew.eatherington@gmail.com’s picture

Hi, Is this the patch for the module?

Thanks

agentrickard’s picture

andrew.eatherington@gmail.com’s picture

Thanks. Just tried to run it in the root but no deal. Could you tell me which file it is supposed to patch?

agentrickard’s picture

The patch is malformed. Try changing this line:

RCS file: /cvs/drupal/drupal/modules/node/node.module,v

To:

RCS file: modules/node/node.module,v

But, really, learn to patch.

http://drupal.org/patch/create
http://drupal.org/patch/apply

agentrickard’s picture

Actually, the patch was fine. See http://drupal.org/patch/apply for help.

agentrickard’s picture

Status: Needs review » Patch (to be ported)

Committed to HEAD. Thanks!

agentrickard’s picture

Status: Patch (to be ported) » Fixed

This is not an issue in D5.

andrew.eatherington@gmail.com’s picture

I've tried both and it still fails:

can't find file to patch at input line 9
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|? multiple_node_access.patch
|Index: modules/node/node.module
|===================================================================
|RCS file: modules/node/node.module,v
|retrieving revision 1.947.2.15
|diff -u -p -r1.947.2.15 node.module
|--- modules/node/node.module	16 Feb 2009 14:39:40 -0000	1.947.2.15
|+++ modules/node/node.module	31 May 2009 18:10:32 -0000

I used the command

patch < multiple_node_access_4.patch

in the root of domain module

agentrickard’s picture

This is a patch to Drupal core. Run it from Drupal root.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Jerome F’s picture

Title: multiple_node_access.patch needs update for Drupal 6.14 » multiple_node_access.patch doesn't need update for Drupal 6.16 ?
Category: task » support
Status: Closed (fixed) » Active

It seems to me that this patch works fine with drupal 6.16
Could anyone more advanced than me confirm please ?

___
I have got :
$ patch -p0 < multiple_node_access.patchpatching file modules/node/node.module
Hunk #1 succeeded at 2037 (offset 5 lines).
Hunk #2 succeeded at 2099 (offset 5 lines).
Hunk #3 succeeded at 2137 (offset 5 lines).
Hunk #4 succeeded at 2146 (offset 5 lines).

agentrickard’s picture

Category: support » task
Status: Active » Needs work

That's all fine, but it needs a minor update. You are all set.

If you see 'failed' messages, then the patch did not apply cleanly.

agentrickard’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new6.39 KB

Revised version.

agentrickard’s picture

Status: Reviewed & tested by the community » Fixed
StatusFileSize
new6.4 KB

Slightly better. Committed.

andybill’s picture

applied, no probs so far - thanks!

Jerome F’s picture

#21 applied with success

Thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

danmed’s picture

Version: 6.x-2.x-dev » 6.x-2.13

Hello,
Sorry to comment in a thread that's set to closed, but I looked around and this is la most recent info on the subject. I have a couple of questions:
- I am running Drupal 6.26, and the last version of the patch here does not apply (Hunk #1 FAILED at 2037. and so on). Is there a more recent version of the patch I could use? Is this patch "maintained" so it is updated with each core version?
- Is this patch still the way to fix things when wanting to use DA (with Domain Strict) along with Node Access for instance? If not, can you help and point me in the right direction?

Thanks a lot for your answer. This has now become a critical for my projects.

Edit: I made further searches and found out that the patch file is included in each DM module release, but neither the stable or the dev version ones work with core 6.26.

Encarte’s picture

Version: 6.x-2.13 » 6.x-2.x-dev

@danmed this post is closed, you should open a new one.