You are here

function userone_admin_settings in User One 6

Same name and namespace in other branches
  1. 7 userone.module \userone_admin_settings()
1 string reference to 'userone_admin_settings'
userone_menu in ./userone.module
Implementation of hook_menu().

File

./userone.module, line 212
User One module.

Code

function userone_admin_settings() {
  $form['info'] = array(
    '#value' => '<p>' . t('User One authenticates the admin account (user 1) using login name in place of username. The module may conflict with  other 3rd party authentication modules.') . '</p>',
  );
  $form['userone_name'] = array(
    '#type' => 'textfield',
    '#title' => t('User One Login Name'),
    '#description' => t('In order to ensure uniqueness of the login name, you are <strong>strongly encouraged to use illegal characters</strong> for regular user name such as !@#$%&*.'),
    '#default_value' => variable_get('userone_name', ''),
  );
  $form['userone_ip'] = array(
    '#type' => 'textarea',
    '#title' => t('Allowed IP addresses'),
    '#description' => t('List one IP per line which admin account should login from. Missing trailing numbers will be interpreted as wildcard. (i.e., 123.45 will allow all IPs like 123.45.*.*). If empty, there will be no restriction.'),
    '#default_value' => variable_get('userone_ip', ''),
  );
  $roles = user_roles(TRUE, 'administer users');
  if ($roles) {
    $form['userone_edit_access'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Allow editing user one account'),
      '#default_value' => variable_get('userone_edit_access', array()),
      '#options' => $roles,
      '#description' => t("User One blocks all roles with 'administer users' permission from editing user one account. Check roles for which you want to allow editing user one account, which is not recommended. Additionally, delete access to user one is blocked for everyone including user one itself."),
    );
  }
  else {
    $form['userone_edit_access_info'] = array(
      '#type' => 'item',
      '#title' => t('Access to user one edit blocked'),
      '#description' => t('No account except user one account can edit user one account regardless of roles and permissions.'),
    );
  }
  $roles = user_roles(FALSE, 'access user profiles');
  if ($roles) {
    $form['userone_view_access'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Allow viewing user one account'),
      '#default_value' => variable_get('userone_view_access', userone_access_raw('view')),
      '#options' => $roles,
      '#description' => t("Uncheck roles for which you want to disallow viewing user one account even if they have 'access user profiles' permission."),
    );
  }
  else {
    $form['userone_view_access_info'] = array(
      '#type' => 'item',
      '#title' => t('Access to user one profile blocked'),
      '#description' => t('No account except user one account can view user one account.'),
    );
  }
  return system_settings_form($form);
}