Note that some aspects of access control have been changed in Drupal 6.2. This handbook pages reflects these API changes (more).
The access callback
and the access arguments
decide whether the user has access to a given menu entry or not.
$items['admin/user/roles'] = array(
'title' => 'Roles',
'description' => 'List, edit, or add user roles.',
'access callback' => 'user_access',
'access arguments' => array('administer access control'),
);
The menu system will call the function user_access
with the arguments administer access control
.
If your module defines access arguments
but does not define an access callback
, then the menu system defaults to using user_access
as the access callback
. In other words:
$items['admin/user/roles'] = array(
'title' => 'Roles',
'description' => 'List, edit, or add user roles.',
'access arguments' => array('administer access control'),
);
is equivalent to:
<?php
$items['admin/user/roles'] = array(
'title' => 'Roles',
'description' => 'List, edit, or add user roles.',
'access callback' => 'user_access', // menu system adds this callback automatically