You are here

function config_perms_menu_alter in Custom Permissions 6

Same name and namespace in other branches
  1. 6.2 config_perms.module \config_perms_menu_alter()
  2. 7.2 config_perms.module \config_perms_menu_alter()

Implementation of hook_menu_alter().

File

./config_perms.module, line 48
Adds more granular permissions for items under 'administer site configuration'.

Code

function config_perms_menu_alter(&$items) {
  foreach ($GLOBALS['config_perms_map'] as $perm => $urls) {
    foreach ($urls as $url) {
      $items[$url]['access callback'] = 'config_perms_access_callback';
      $items[$url]['access arguments'] = array(
        $perm,
      );
    }
  }

  // administer themes:
  foreach (list_themes() as $theme) {
    $items['admin/build/themes/settings/' . $theme->name]['access callback'] = 'config_perms_themes_access';
    $items['admin/build/themes/settings/' . $theme->name]['access arguments'] = array(
      $theme,
    );
  }
}