You are here

public function LdapUserConf::load in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_user/LdapUserConf.class.php \LdapUserConf::load()
1 call to LdapUserConf::load()
LdapUserConf::__construct in ldap_user/LdapUserConf.class.php

File

ldap_user/LdapUserConf.class.php, line 246

Class

LdapUserConf

Code

public function load() {
  if ($saved = variable_get("ldap_user_conf", FALSE)) {
    $this->inDatabase = TRUE;
    foreach ($this->saveable as $property) {
      if (isset($saved[$property])) {
        $this->{$property} = $saved[$property];
      }
    }
  }
  else {
    $this->inDatabase = FALSE;

    // By default this variable should be 0 if the "sharedemail" module
    // is not enabled, or 1 if the module is.
    $this->accountsWithSameEmail = (int) module_exists('sharedemail');
  }

  // Determine account creation configuration.
  $user_register = variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
  if ($this->acctCreation == LDAP_USER_ACCT_CREATION_LDAP_BEHAVIOR_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;
  }
}