You are here

function _ldapgroups_ldap_init in LDAP integration 5

Same name and namespace in other branches
  1. 6 ldapgroups.inc \_ldapgroups_ldap_init()
1 call to _ldapgroups_ldap_init()
ldapgroups_user_login in ./ldapgroups.module

File

./ldapgroups.module, line 430

Code

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