Let's say I have a custom module as "mycustommenu" and have a hook menu and hook perm as
function mycustommenu_perm {
return array('hi','hello','welcome','bye');
}
function mycustommenu_menu() {
global $user;
$items['mycustommenu'] = array(
'title' => 'custom menu',
'page callback' => 'mycustommenu_welcome',
'page arguments' => array($user->name),
'access callback' => 'user_access',
'access arguments' => array('welcome'),
'type' => MENU_NORMAL_ITEM,
);
and the callback function is
function mycustommenu_welcome($uname='')
{
return t('welcome @uname',array('@uname' => $uname));
}
Now if you go to user->permissions in your drupal instance ,under mycustommenu module you will be able to see four permission sets as 'hi','hello','welcome','bye'.
Suppose you want to show the message "welcome drupal_user_name" for anonymous (or what ever your roles)user then you have to pass one one of the parameter that is available in hook perm i.e. mycustommenu_perm. Dont forget to set the permission in your drupal instance.