function ldap_authentication_ldap_authenticated in Lightweight Directory Access Protocol (LDAP) 8.3
Same name and namespace in other branches
- 8.2 ldap_authentication/ldap_authentication.module \ldap_authentication_ldap_authenticated()
- 7.2 ldap_authentication/ldap_authentication.module \ldap_authentication_ldap_authenticated()
- 7 ldap_authentication/ldap_authentication.module \ldap_authentication_ldap_authenticated()
Are we LDAP authenticated.
Parameters
int|User $user: The user account.
Return value
bool True if user is recorded as LDAP authenticated and identified.
4 calls to ldap_authentication_ldap_authenticated()
- LdapAuthenticationConfiguration::showPasswordField in ldap_authentication/
src/ Helper/ LdapAuthenticationConfiguration.php - Should the password field be shown?
- ldap_authentication_form_user_form_alter in ldap_authentication/
ldap_authentication.module - Implements hook_form_FORM_ID_alter().
- ldap_authentication_user_pass_validate in ldap_authentication/
ldap_authentication.module - Change how password is validated.
- UserHelpTabAccess::accessLdapHelpTab in ldap_authentication/
src/ Access/ UserHelpTabAccess.php - Access callback for help tab.
File
- ldap_authentication/
ldap_authentication.module, line 41 - This module injects itself into Drupal's Authentication stack.
Code
function ldap_authentication_ldap_authenticated($user) {
if (is_numeric($user)) {
$user = @\Drupal::entityManager()
->getStorage('user')
->load((int) $user);
}
if (!is_object($user) || $user
->id() == 0) {
return FALSE;
}
$authname = ExternalAuthenticationHelper::getUserIdentifierFromMap($user
->id());
return !empty($authname);
}