function hook_ldap_authentication_allowuser_results_alter in Lightweight Directory Access Protocol (LDAP) 8.4
Same name and namespace in other branches
- 8.2 ldap_authentication/ldap_authentication.api.php \hook_ldap_authentication_allowuser_results_alter()
- 8.3 ldap_authentication/ldap_authentication.api.php \hook_ldap_authentication_allowuser_results_alter()
- 7.2 ldap_authentication/ldap_authentication.api.php \hook_ldap_authentication_allowuser_results_alter()
Alter the allowed user results.
Allow a custom module to examine the user's LDAP details and refuse authentication. The actual $hook_result is passed by reference. See also: http://drupal.org/node/1634930
Parameters
\Symfony\Component\Ldap\Entry $ldap_user: An LDAP entry.
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()
- LoginValidatorBase::checkAllowedExcluded in ldap_authentication/
src/ Controller/ LoginValidatorBase.php - Check if exclusion criteria match.
File
- ldap_authentication/
ldap_authentication.api.php, line 27
Code
function hook_ldap_authentication_allowuser_results_alter(Entry $ldap_user, string $name, bool &$hook_result) {
// Other module has denied user, should not override.
if (!$hook_result) {
return;
}
// Other module has allowed, maybe override.
if (mymodule_dissapproves($ldap_user, $name)) {
$hook_result = FALSE;
}
}