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

Scott Reynolds sdrreynolds at gmail.com
Sun Jan 13 18:52:44 UTC 2008


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

So revised using node_uid table like as follows

hook__node_access_records()
  // add the admin access row
 $grants[] = array(
   'realm' => 'node_author',
   'gid' => $node_uid_record->nid,
   'grant_view' => 1,
   'grant_update' => 1,
   'grant_delete' => 1
 );
 return $grants;*

* hook_node_grants()
foreach ($node_uid_records as $node_uid_record) {
   $grants['node_author'] [] = $node_uid_record->nid
}
return $grants

I have done the same in the ejournal module, but what is not possible
> with this approach is to track ownership or assign rights to
> individual users (as opposed to groups). Think of it in this way:
> access rights may be rebuild by other modules, if you do not keep
> track of node-authors relationships, you are not able to recreate the
> rights using information from node_access table only (using drupal
> hooks) because access rights are deleted before being refreshed.
> The proposed approach of node_uid table would solve this and many
> other related problems.
>
> I am struggling with the multiple authorship issue since the very
> beginning, ie. D4.6, there are potentially a lot of modules who would
> benefit from this functionality. I am sorry, that it is probably too
> late for D6.
>
> roman
>

On Jan 13, 2008 6:32 PM, Scott Reynolds <sdrreynolds at
gmail.com<http://lists.drupal.org/listinfo/development>>
> wrote:
> >* 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<http://lists.drupal.org/listinfo/development>
> *
> >


-- 
Scott Reynolds
Cell: 630-254-2474
http://www.scottreynolds.us
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20080113/4010859c/attachment.htm 


More information about the development mailing list