Something that doesn't seem to be written down anywhere is that the access callback is also used when deciding to display a NORMAL_MENU_ITEM as well as when deciding if the user has access to the page pointed to by the NORMAL_MENU_ITEM.

This can make writing custom user access routines a little tricky since you don't really have any way to check which context the user access routine is being called in.

I would propose that the Drupal 7 (or, 6 for that matter) folks add another pair of keys to the menu definition:

'menu access'

which is called to determine if the NORMAL_MENU_ITEM is to be displayed and reserve 'access callback' to determine if the page pointed to by the NORMAL_MENU_ITEM can be accessed.

This callback need not take arguments (although it should, just in case someone can figure out a use for them) in which case another key:

'menu access arguments'

should be added which can be an array of arguments as per 'access arguments'.

If the 'menu access' is omitted, but the 'menu access arguments' are supplied, then the 'user access' callback is taken with the 'menu access arguments'. If both are omitted, then the 'user access' callback with the 'access arguments' is called, which is the current behavior.

That way, no code breaks.

Best,

Dick Munroe

Comments

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.