[development] Question about Drupal ACLs

Dave Cohen drupal at dave-cohen.com
Wed Jul 12 16:48:34 UTC 2006


Nick,

Here's my understanding hopefully someone will correct me if I'm wrong.  You 
asked about hiding node and the menu items that link to them based on user 
roles.

Unfortunately, the menu items and the nodes are completely seperate things, 
each with their own mechanism to hide or make visible.  Nodes can be 
effectively hidden thanks to the node_access database table.  There are a 
number of contrib packages that make use of this.  These packages hide nodes 
based on taxonomy or user role or what have you.

Menu items come from two places.  Either a) the database, or b) a hook_menu 
callback.

When generating a menu item via hook_menu, the programmer can associate an 
access value with the item, effectively hiding it from some users.

When the menu item comes from the database, there is no way to do this.  
(someone correct me if I'm wrong.)  The item will always be visible to all 
users.  These type of menu items are generated when you fill in the menu 
settings fieldset on a node edit form, or when you add items from admin/menu.  
Bottom line: there is no way to hide these items at present.

To do what you want, you'll have to generate those menu items from hook_menu.

-Dave


On Wednesday 12 July 2006 07:43, Nick Whalen wrote:
> On Mon, 2006-07-10 at 21:31 -0400, Khalid B wrote:
> > Did you try simple_access?
> >
> > It allows access by role on the node level, via one level of indirection.
>
> Yes I did, however it didn't meet my primary criteria of being able to
> hide/show certain items on the primary nav menu based on what role of
> user was logged in.  Any other suggestions?
>
> (Sorry it took so long to reply, been busy ;))


More information about the development mailing list