Look at this code:
#v+
$grants[] = array(
'realm' => 'example',
'gid' => TRUE,
'grant_view' => TRUE,
'grant_update' => FALSE,
'grant_delete' => FALSE,
'priority' => 0,
);
#v-
When I use "'gid' => TRUE" it works incorrect, it will add to node_access table lines like that ignoring all other realms for this node:
nid gid realm grant_view grant_update grant_delete
5 0 all 1 0 0
But when I use "'gid' => TRUE" it will work ok and add lines like that
nid gid realm grant_view grant_update grant_delete
5 0 example 1 0 0
5 0 example_other_realm 1 1 0
Please check and fix.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 762260-5.patch | 422 bytes | sender |
Comments
Comment #1
jhodgdonI can't understand what you are saying... It looks like you said it doesn't work for 'gid' => TRUE and then you said it does work for 'gid' => TRUE?
It does look to me as though the Drupal 6 function body example for hook_node_access_records should be using 'gid' => 1 in here:
http://api.drupal.org/api/function/hook_node_access_records/6
because the corresponding hook_node_grants is:
http://api.drupal.org/api/function/hook_node_grants/6
Is that what you meant to say, that it should be 'gid' => 1?
Comment #2
dealancer commentedI'm sorry I did a copy-past error.
'gid' => 1
should be there, you are right.
Comment #3
jhodgdonOK, agreed, that hook example body should be updated to use 'gid' => 1.
It's correct in D7 by the way.
Thanks for reporting this!
Comment #4
jhodgdonGood project for a novice doc contributor
Comment #5
sender commentedQuick (haha) fix.
Comment #6
sender commentedNote that this is part of the contributions repository!
Comment #7
jhodgdonCommitted to the contrib repository. Thanks!