You are here

function password_policy_menu in Password Policy 5

Same name and namespace in other branches
  1. 6 password_policy.module \password_policy_menu()
  2. 7.2 password_policy.module \password_policy_menu()
  3. 7 password_policy.module \password_policy_menu()

Implementation of hook_menu().

File

./password_policy.module, line 53

Code

function password_policy_menu($may_cache) {
  $items = array();
  if (!$may_cache) {
    $items[] = array(
      'path' => 'admin/settings/password_policy',
      'title' => t('Password policy'),
      'description' => t('Configures policies for user account passwords.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'password_policy_admin_settings',
      ),
      'access' => user_access('administer site configuration'),
    );
  }
  $items[] = array(
    'path' => 'admin/user/password_policy',
    'title' => t('Password policy'),
    'description' => t('Configures policies for user account passwords.'),
    'callback' => 'password_policy_view',
    'access' => user_access('administer password policies'),
  );
  $items[] = array(
    'path' => 'admin/user/password_policy/add',
    'title' => t('Add policy'),
    'callback' => 'password_policy_form_policy',
    'access' => user_access('administer password policies'),
    'type' => MENU_LOCAL_TASK,
  );
  $arg4 = arg(4);
  if (!empty($arg4) && is_numeric($arg4)) {
    $items[] = array(
      'path' => 'admin/user/password_policy/edit/' . arg(4),
      'title' => t('Edit password policy'),
      'callback' => 'password_policy_form_policy',
      'callback arguments' => array(
        'id' => arg(4),
      ),
      'type' => MENU_CALLBACK,
      'access' => user_access('administer password policies'),
    );
    $items[] = array(
      'path' => 'admin/user/password_policy/delete/' . arg(4),
      'title' => t('Delete password policy'),
      'callback' => 'password_policy_delete',
      'callback arguments' => array(
        'id' => arg(4),
      ),
      'type' => MENU_CALLBACK,
      'access' => user_access('administer password policies'),
    );
  }

  // we display the name of the policy when viewing
  $arg3 = arg(3);
  if (!empty($arg3) && is_numeric($arg3)) {
    $policy = password_policy_load_policy_by_id(arg(3));
    $items[] = array(
      'path' => 'admin/user/password_policy/' . arg(3),
      'title' => $policy->name,
      'callback' => 'password_policy_view',
      'callback arguments' => array(
        'id' => arg(3),
      ),
      'type' => MENU_CALLBACK,
      'access' => user_access('administer password policies'),
    );
  }
  $items[] = array(
    'path' => 'admin/user/password_policy/list',
    'title' => t('List'),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items[] = array(
    'path' => 'admin/user/password_policy/list_expired',
    'title' => t('Expired accounts'),
    'callback' => 'password_policy_list_expired',
    'access' => user_access('administer password policies'),
    'type' => MENU_LOCAL_TASK,
  );
  $items[] = array(
    'path' => 'admin/user/password_policy/unblock/' . arg(4),
    'title' => t('Unblock'),
    'callback' => 'password_policy_unblock',
    'callback arguments' => array(
      'id' => arg(4),
    ),
    'type' => MENU_CALLBACK,
    'access' => user_access('administer password policies'),
  );
  return $items;
}