You are here

function LdapAuthenticationConf::load in Lightweight Directory Access Protocol (LDAP) 7

Same name and namespace in other branches
  1. 8.2 ldap_authentication/LdapAuthenticationConf.class.php \LdapAuthenticationConf::load()
  2. 7.2 ldap_authentication/LdapAuthenticationConf.class.php \LdapAuthenticationConf::load()
1 call to LdapAuthenticationConf::load()
LdapAuthenticationConf::__construct in ldap_authentication/LdapAuthenticationConf.class.php

File

ldap_authentication/LdapAuthenticationConf.class.php, line 83
This class represents an ldap_authentication module's configuration It is extended by LdapAuthenticationConfAdmin for configuration and other admin functions

Class

LdapAuthenticationConf
@file This class represents an ldap_authentication module's configuration It is extended by LdapAuthenticationConfAdmin for configuration and other admin functions

Code

function load() {
  if ($saved = variable_get("ldap_authentication_conf", FALSE)) {
    $this->inDatabase = TRUE;
    foreach ($this->saveable as $property) {
      if (isset($saved[$property])) {
        $this->{$property} = $saved[$property];
      }
    }
    $enabled_ldap_servers = ldap_servers_get_servers(NULL, 'enabled');
    foreach ($this->sids as $sid => $enabled) {
      if ($enabled && isset($enabled_ldap_servers[$sid])) {
        $this->enabledAuthenticationServers[$sid] = $enabled_ldap_servers[$sid];
      }
    }
  }
  else {
    $this->inDatabase = FALSE;
  }
  $this->ssoEnabled = module_exists('ldap_sso');
  $this->apiPrefs['requireHttps'] = variable_get('ldap_servers_require_ssl_for_credentails', 1);
  $this->apiPrefs['encryption'] = variable_get('ldap_servers_encryption', LDAP_SERVERS_ENC_TYPE_CLEARTEXT);

  // determine account creation configuration
  $user_register = variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
  if ($this->acctCreation == LDAP_AUTHENTICATION_ACCT_CREATION_DEFAULT || $user_register == USER_REGISTER_VISITORS) {
    $this->createLDAPAccounts = TRUE;
    $this->createLDAPAccountsAdminApproval = FALSE;
  }
  elseif ($user_register == USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL) {
    $this->createLDAPAccounts = FALSE;
    $this->createLDAPAccountsAdminApproval = TRUE;
  }
  else {
    $this->createLDAPAccounts = FALSE;
    $this->createLDAPAccountsAdminApproval = FALSE;
  }
}