You are here

function _ldapdata_ldap_init in LDAP integration 5.2

Same name and namespace in other branches
  1. 5 ldapdata.module \_ldapdata_ldap_init()
1 call to _ldapdata_ldap_init()
ldapdata_user_load in ./ldapdata.module

File

./ldapdata.module, line 871

Code

function _ldapdata_ldap_init(&$user) {
  global $ldap;
  if ($row = db_fetch_object(db_query("SELECT * FROM {ldapauth} WHERE status = '%s' AND name = '%s'", 1, $user->ldap_config))) {
    $ldap = new LDAPInterface();
    $ldap
      ->setOption('name', $row->name);
    $ldap
      ->setOption('server', $row->server);
    $ldap
      ->setOption('port', $row->port);
    $ldap
      ->setOption('tls', $row->tls);
    $ldap
      ->setOption('encrypted', $row->encrypted);
    $ldap
      ->setOption('basedn', $row->basedn);
    $ldap
      ->setOption('user_attr', $row->user_attr);
    return $ldap;
  }
  else {
    return;
  }
}