You are here

public function SimpleLdapSSO::__construct in Simple LDAP 7

Same name and namespace in other branches
  1. 7.2 simple_ldap_sso/SimpleLdapSSO.class.php \SimpleLdapSSO::__construct()

Constructor.

Parameters

string $name: The Drupal username.

File

simple_ldap_sso/SimpleLdapSSO.class.php, line 87
SimpleLdapSSO object.

Class

SimpleLdapSSO
@file SimpleLdapSSO object.

Code

public function __construct($name) {
  $parameters = array(
    'binddn' => variable_get('simple_ldap_sso_binddn'),
    'bindpw' => variable_get('simple_ldap_sso_bindpw'),
    'readonly' => FALSE,
  );

  // If this site is in RO mode, use a separate server connection with the
  // above RW credentials.
  $this->server = variable_get('simple_ldap_readonly') ? new SimpleLdapServer($parameters) : SimpleLdapServer::singleton();

  // Get the LDAP configuration.
  $ldap_user = SimpleLdapUser::singleton($name);
  $this->dn = $ldap_user->dn;
}