Where is the Access Control permission for Image and Gallery Content Creation?

albert_jeremie - August 27, 2008 - 07:15
Project:Yet Another Gallery Module
Version:5.x-1.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:babruix
Status:needs review
Description

I have a problem configuring the Access permission for creating Image and Gallery content.
For the admin, I have no problem, but for authenticated user, they cannot access the node.
I have search through the Access Control page, but there is no Image or Gallery content creation permission.
Is this a bug?
I hope you can fix this as soon as possible, because your module is great!!!
Thanks.

You can visit my site at basileateens.com

#1

babruix - December 2, 2008 - 11:56
Version:5.x-1.0-alpha2» 5.x-1.x-dev
Assigned to:Anonymous» babruix
Status:active» needs review

Yes, authors make this module very fast and didn`t made permissions control!
Solution is to add this code to yagm.module:

/**
*  Implementation of hook_perm.
*/
function yagm_perm() {
  return array('create gallery', 'edit own galleries');
}

/**
* Implementation of hook_access.
*/
function yagm_access($op, $node) {
  global $user;
  if ($op == 'create') {
    return user_access('create gallery');
  }
  if ($op == 'update' || $op == 'delete') {
    if (user_access('edit own galleries') && ($user->uid == $node->uid)) {
      return TRUE;
    }
  }
}

 
 

Drupal is a registered trademark of Dries Buytaert.