You are here

function shib_auth_config in Shibboleth Authentication 7.4

Same name and namespace in other branches
  1. 6.4 shib_auth.module \shib_auth_config()

Configuration handler.

Stores default configuration values and returns the active configuration parameter or the list of configuration parameters when $list is set to TRUE.

Parameters

string $variable: The name of the variable.

bool $list: If set to TRUE, all configuration parameter names are returned. It's only intended to be used for debug purposes.

Return value

mixed The matching variable prefixed with shib_auth_, or the list of the module configuration variables, if $list is TRUE.

19 calls to shib_auth_config()
shib_auth_admin_advanced in ./shib_auth_forms.inc
Form constructor for the shib_auth admin advanced page.
shib_auth_admin_general in ./shib_auth_forms.inc
Form constructor for the shib_auth admin general page.
shib_auth_block_configure in ./shib_auth.module
Implements hook_block_configure().
shib_auth_cancel_custom in ./shib_auth.module
Redirects the user when Cancel button is pressed.
shib_auth_custom_data in ./shib_auth_forms.inc
Form constructor for the shib_auth custom form.

... See full list

File

./shib_auth.module, line 24
Drupal Shibboleth authentication module.

Code

function shib_auth_config($variable, $list = FALSE) {

  // Building an array with the available variables, and their default values.
  static $var_store = array();
  if (empty($var_store)) {
    $var_store = array(
      'account_linking' => FALSE,
      'account_linking_text' => t('Link this account with another identity'),
      'auto_destroy_session' => FALSE,
      'debug_state' => FALSE,
      'define_username' => FALSE,
      'enable_custom_mail' => FALSE,
      'forceauthn' => FALSE,
      'force_https' => FALSE,
      'is_passive' => FALSE,
      'terms_accept' => FALSE,
      'debug_url' => '',
      'terms_ver' => '',
      'terms_url' => '/',
      'wayf_uri' => '/DS',
      'handler_protocol' => 'https',
      'handler_url' => '/Shibboleth.sso',
      'email_variable' => 'HTTP_SHIB_MAIL',
      'username_variable' => 'REMOTE_USER',
      'login_url' => '',
      'logout_url' => url('<front>'),
      'link_text' => t('Shibboleth Login'),
      'full_handler_url' => shib_auth_get_handler_base() . variable_get('shib_auth_wayf_uri', '/DS'),
      'full_logout_url' => shib_auth_get_handler_base() . '/Logout',
    );
  }
  if ($list) {
    return array_keys($var_store);
  }

  // Check, if it exists in the array above, and get its value.
  if (isset($var_store[$variable]) || array_key_exists($variable, $var_store)) {
    return variable_get("shib_auth_{$variable}", $var_store[$variable]);
  }
  else {
    drupal_set_message(t("Function shib_auth_config(%variable) called but %variable doesn't exists.", array(
      '%variable' => $variable,
    )), 'error');
    return FALSE;
  }
}