You are here

function user_permissions_menu in User Permissions 5

Same name and namespace in other branches
  1. 6 user_permissions.module \user_permissions_menu()
  2. 7 user_permissions.module \user_permissions_menu()

Implementation of hook_menu().

File

./user_permissions.module, line 17

Code

function user_permissions_menu($may_cache) {
  $items = array();
  if (!$may_cache && user_access('administer permissions')) {
    if (user_access('administer permissions')) {
      $arg = arg(1);
      $user = user_load(array(
        'uid' => $arg,
      ));
      if ($user != FALSE) {
        $items[] = array(
          'path' => 'user/' . $arg . '/permissions',
          'title' => t('User Permissions'),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'user_permissions_profile_permissions_form',
            $arg,
          ),
          'access' => user_access('administer permissions'),
          'type' => MENU_LOCAL_TASK,
        );
      }
    }
    $items[] = array(
      'path' => 'admin/user/roles',
      'title' => t('Roles'),
      'description' => t('List, edit, or add user roles.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'user_permissions_user_admin_new_role',
      ),
      'access' => user_access('administer access control'),
      'type' => MENU_NORMAL_ITEM,
    );
  }
  return $items;
}