You are here

function _ldapauth_init in LDAP integration 6

Same name and namespace in other branches
  1. 5.2 ldapauth.module \_ldapauth_init()
  2. 5 ldapauth.module \_ldapauth_init()

Initiates the LDAPInterfase class.

Parameters

$sid: An ID of the LDAP server configuration or user object.

6 calls to _ldapauth_init()
hook_ldap_convert_to_local_alter in ./ldapauth.api.php
Called when an existing ldap user is converted back to a normal Drupal user. This is called before the account is saved to remove ldapauth specific user properties.
ldapauth_admin_form_submit in ./ldapauth.admin.inc
Submit hook for the LDAP server form.
ldaphelp_ldap_user_verify in ldaphelp/ldaphelp.module
Verify that a user can be found from the Drupal account information.
_ldapauth_ajax_test in ./ldapauth.admin.inc
Implements the AJAX server test.
_ldapauth_auth in ./ldapauth.module
Authenticate the user against LDAP servers.

... See full list

File

./ldapauth.module, line 674
ldapauth provides authentication against ldap server.

Code

function _ldapauth_init($sid) {
  global $_ldapauth_ldap;
  if (!($sid = is_object($sid) ? isset($sid->ldap_config) ? $sid->ldap_config : NULL : $sid)) {
    return;
  }
  $server = ldapauth_server_load($sid);
  if (!empty($server) && $server->status == 1) {
    $_ldapauth_ldap = new LDAPInterface();
    $_ldapauth_ldap
      ->setOption('sid', $sid);
    $_ldapauth_ldap
      ->setOption('name', $server->name);
    $_ldapauth_ldap
      ->setOption('machine_name', $server->machine_name);
    $_ldapauth_ldap
      ->setOption('server', $server->server);
    $_ldapauth_ldap
      ->setOption('port', $server->port);
    $_ldapauth_ldap
      ->setOption('tls', $server->tls);
    $_ldapauth_ldap
      ->setOption('enc_type', $server->enc_type);
    $_ldapauth_ldap
      ->setOption('basedn', $server->basedn);
    $_ldapauth_ldap
      ->setOption('user_attr', $server->user_attr);
    $_ldapauth_ldap
      ->setOption('mail_attr', $server->mail_attr);
    $_ldapauth_ldap
      ->setOption('puid_attr', $server->puid_attr);
    $_ldapauth_ldap
      ->setOption('binary_puid', $server->binary_puid);
    $_ldapauth_ldap
      ->setOption('binddn', $server->binddn);
    $_ldapauth_ldap
      ->setOption('bindpw', $server->bindpw);
    return $_ldapauth_ldap;
  }
  return FALSE;
}