[development] Multiple user aliases - Multiple user node, ownership

Scott Reynolds sdrreynolds at gmail.com
Sun Jan 13 17:32:59 UTC 2008


Heres how I have allowed multiple users to be able to edit one node. Custom
node_access module

hook__node_access_records()
 // add the admin access row
    $grants[] = array(
      'realm' => 'og_admin',
      'gid' => $node->group,
      'grant_view' => 1,
      'grant_update' => 1,
      'grant_delete' => 1
    );
    return $grants;

then..
hook_node_grants()
foreach ($account->og_groups as $group) {
      if ($group['is_admin'] == 1) {
        // grant this user admin priv over all nodes in group
        $grants['og_admin'][] = $group['nid'];
      }
}
return $grants

Then hook_enable()
  node_access_rebuild();

Its simple and it works. I may have some typos in there but thats the basic
idea. Same trick can be applied to roles. So you can have editor roles that
can change any node on the site.

-- 
Scott Reynolds
Senior Developer and Engineer
MothersClick
scott at mothersclick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20080113/6e2e1711/attachment-0001.htm 


More information about the development mailing list