Looking at this page: node_access_acquire_grants(), I'm thinking that the way the documentation is written, it is a little difficult to understand. Now it says this:

It is called at node save, and should be called by modules whenever something other than a node_save causes the permissions on a node to change.

But I'm thinking that it would be more clear if it were written like this:

This function is called at node save. Modules should [only] call this function whenever something other than a node_save causes the permissions on a node to change.

I had to read the original text a few times before I understood it - that's if I understood it! I guess the telling point is if the quote I added matches the original meaning or not.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

Title: Documentation problem with node_access_acquire_grants » node_access_acquire_grants doc header needs some cleanup
Version: 6.x-dev » 7.x-dev

Agreed, that function doc definitely needs a bit of cleanup. It also says "This function will call module invoke to...", which doesn't even mention which hook is invoked. Sheesh!

And it should be fixed in D7 first, then ported back to D6.

jhodgdon’s picture

Status: Active » Needs review
FileSize
2.31 KB

Here's a doc cleanup patch, for this function and the next one below it in the file. Should be ported to D6 if accepted.

Dries’s picture

Status: Needs review » Fixed

Committed to CVS HEAD.

jhodgdon’s picture

Version: 7.x-dev » 6.x-dev
Status: Fixed » Patch (to be ported)

Needs D6 port.

rdrh555’s picture

Assigned: Unassigned » rdrh555
Status: Patch (to be ported) » Needs review
FileSize
2.04 KB
jhodgdon’s picture

Status: Needs review » Needs work

In the D6 version of http://api.drupal.org/api/function/node_access_acquire_grants, there is actually no call to hook_node_access_records_alter() (i.e. no drupal_alter('node_access_records'). So this patch is not correct for D6.

rdrh555’s picture

Status: Needs work » Needs review
FileSize
1.93 KB

Ah yes, only D7 lets modules alter the grants, thanks.

jhodgdon’s picture

The text looks right now. One minor line wrap issue:

+ * This function is called when a node is saved, and can also be called by
+ * modules if something other than a node_save causes node access permissions
+ * to change. It collects all node access grants for the node from
+ * hook_node_access_records() implementations and saves the
+ * collected grants to the database.

I think collected should be on the previous line?

rdrh555’s picture

FileSize
1.93 KB

I agree; this should do it.

jhodgdon’s picture

Sorry, missed this in the last readthrough:

All functions should have () after them, such as node_save(). This makes them turn into links on api.drupal.org.

rdrh555’s picture

FileSize
1.93 KB

I added an underscore by accident; your patch did not do that and I assume wasn't meant to reference a function:
* modules if something other than a node save causes node access permissions

Removes the underscore:

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! That looks fine.

jhodgdon’s picture

Status: Reviewed & tested by the community » Needs work

Oops, spoke too soon. The patch needs to be rerolled from the Drupal root.

rdrh555’s picture

Status: Needs work » Needs review
FileSize
1.3 KB

grrr, wrong setting in Eclipse, I think. Better?

rdrh555’s picture

FileSize
1.97 KB

double grrr. IGNORE #14, wrong patch. Correct one:

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Looks fine now, thanks!

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed.

Status: Fixed » Closed (fixed)

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