Making handbook editable by all (was Re: [documentation] the documentation site...<snip>)

Charlie Lowe cel4145 at cyberdash.com
Thu Jan 12 14:28:22 UTC 2006



Dries Buytaert wrote:
> 
> On 12 Jan 2006, at 07:31, Boris Mann wrote:
> 
>>>> Only creates are allowed, not edits, as per statement above.
>>>
>>>
>>> This could easily be changed if someone would submit a patch for  the 
>>> book module which implements the "edit all book pages" access  
>>> control such as what I included in the wikipage.module I put up on  
>>> my site. If I could figure out how to do it, it must be simple to  do :)
>>
>>
>> I keep feeling like I'm missing something...doesn't "maintain  books" 
>> give this permission?!
> 
> 
> I'm willing to do the experiment, but I'm not confident it will work.
> 
> Would it be a good idea to allow everyone to commit changes to Drupal  
> core?  I think not.  It takes a small group of people with a good  
> overview to coordinate the many changes, to maintain consistency, to  
> maintain integrity, etc.

There is a good compromise. We do not need to allow everyone to commit 
changes. What we should do is allow everyone to edit any handbook page 
instead of only the pages they have authored. Once the page has been 
edited, it then enters moderation just as now.

This can be accomplished by adding in an "edit all book pages" access 
control. It is different from the "maintain book pages" access control 
because it does not provide them with access to the various 
administrative options such as authoring information and publishing 
options. Here is the code for implementing hook_access for the 4.6 
module I created for doing wikipages:

/**
  * Implementation of hook_access().
  */
function wikipage_access($op, $node) {
   global $user;

   if ($op == 'create') {
     return user_access('create wikipages');
   }

   if ($op == 'update' || $op == 'delete') {
     if (user_access('edit own wikipages') && ($user->uid == $node->uid)) {
       return TRUE;
     }
     if (user_access('edit all wikipages')) {
       return TRUE;
     }
   }
}


More information about the documentation mailing list