You are here

function menu_per_role_access in Menu Per Role 5

File

./menu_per_role.module, line 11
Allows restricting access to menu items per role

Code

function menu_per_role_access($mid) {
  global $user;
  $rids = menu_per_role_get_roles($mid);
  if (user_access('administer')) {

    // Super admin can always access
    return 1;
  }

  //NULL means inherit access from parent item
  return count($rids) ? count(array_intersect($rids, array_keys($user->roles))) : NULL;
}