You are here

function hook_ldap_authentication_allowuser_results_alter in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.4 ldap_authentication/ldap_authentication.api.php \hook_ldap_authentication_allowuser_results_alter()
  2. 8.2 ldap_authentication/ldap_authentication.api.php \hook_ldap_authentication_allowuser_results_alter()
  3. 8.3 ldap_authentication/ldap_authentication.api.php \hook_ldap_authentication_allowuser_results_alter()

Allow a custom module to check user's ldap details and refuse authentication.

See also: http://drupal.org/node/1634930.

Parameters

array $ldap_user: See README.developers.txt for structure.

string $name: The drupal account name or proposed drupal account name if none exists yet.

bool $hook_result: TRUE for allow, FALSE for deny. If set to TRUE or FALSE, another module has already set this and function should be careful about overriding this.

1 invocation of hook_ldap_authentication_allowuser_results_alter()
LdapAuthenticationConf::allowUser in ldap_authentication/LdapAuthenticationConf.class.php
Decide if a username is excluded or not.

File

ldap_authentication/ldap_authentication.api.php, line 22
Summary of hooks and other developer related functions.

Code

function hook_ldap_authentication_allowuser_results_alter(array $ldap_user, $name, &$hook_result) {

  // Other module has denied user, should not override.
  if ($hook_result === FALSE) {
    return;
  }
  elseif ($hook_result === TRUE) {
    if (mymodule_dissapproves($ldap_user, $name)) {
      $hook_result = FALSE;
    }
  }
}