My approach did not involve just the node_access table, it used the og table (to determine if the user is an admin of the group). Just get rid of the og stuff and put in your node_uid table<br><br>So revised using node_uid table like as follows
<br><br>hook__node_access_records()<br>
// add the admin access row<br> $grants[] = array(<br> 'realm' => 'node_author',<br>
'gid' => $node_uid_record->nid,<br>
'grant_view' => 1,<br>
'grant_update' => 1,<br>
'grant_delete' => 1<br> );<br> return $grants;<i><br><br></i>
hook_node_grants()<br>
foreach ($node_uid_records as $node_uid_record) {<br> $grants['node_author'] [] = $node_uid_record->nid<br>
}<br>
return $grants<br><br clear="all"><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">I have done the same in the ejournal module, but what is not possible
<br>with this approach is to track ownership or assign rights to<br>individual users (as opposed to groups). Think of it in this way:<br>access rights may be rebuild by other modules, if you do not keep<br>track of node-authors relationships, you are not able to recreate the
<br>rights using information from node_access table only (using drupal<br>hooks) because access rights are deleted before being refreshed.<br>The proposed approach of node_uid table would solve this and many<br>other related problems.
<br><br>I am struggling with the multiple authorship issue since the very<br>beginning, ie. D4.6, there are potentially a lot of modules who would<br>benefit from this functionality. I am sorry, that it is probably too<br>
late for D6.<br><br> roman<br></blockquote><pre><br></pre><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">On Jan 13, 2008 6:32 PM, Scott Reynolds <
<a href="http://lists.drupal.org/listinfo/development">sdrreynolds at gmail.com</a>> wrote:<br>><i> Heres how I have allowed multiple users to be able to edit one node. Custom</i><br>><i> node_access module</i><br>
><br>><i> hook__node_access_records()</i><br>><i> // add the admin access row</i><br>><i> $grants[] = array(</i><br>><i> 'realm' => 'og_admin',</i><br>><i> 'gid' => $node->group,
</i><br>><i> 'grant_view' => 1,</i><br>><i> 'grant_update' => 1,</i><br>><i> 'grant_delete' => 1</i><br>><i> );</i><br>><i> return $grants;</i>
<br>><br>><i> then..</i><br>><i> hook_node_grants()</i><br>><i> foreach ($account->og_groups as $group) {</i><br>><i> if ($group['is_admin'] == 1) {</i><br>><i> // grant this user admin priv over all nodes in group
</i><br>><i> $grants['og_admin'][] = $group['nid'];</i><br>><i> }</i><br>><i> }</i><br>><i> return $grants</i><br>><br>><i> Then hook_enable()</i><br>><i> node_access_rebuild();
</i><br>><br>><i> Its simple and it works. I may have some typos in there but thats the basic</i><br>><i> idea. Same trick can be applied to roles. So you can have editor roles that</i><br>><i> can change any node on the site.
</i><br>><i> --</i><br>><i> Scott Reynolds</i><br>><i> Senior Developer and Engineer</i><br>><i> MothersClick</i><br>><i> <a href="http://lists.drupal.org/listinfo/development">scott at mothersclick.com</a>
</i><br>></blockquote><pre></pre><br>-- <br>Scott Reynolds<br>Cell: 630-254-2474<br><a href="http://www.scottreynolds.us">http://www.scottreynolds.us</a>