public function SimpleLdapUserAuthenticator::canAuthenticate in Simple LDAP 8
Whether the given name should be checked against the LDAP server.
Parameters
string $name: A username that might or not be an existing user.
Return value
boolean TRUE if the user should be authenticated against the LDAP server. FALSE if it is the username for Drupal user 1.
File
- modules/
simple_ldap_user/ src/ SimpleLdapUserAuthenticator.php, line 52
Class
Namespace
Drupal\simple_ldap_userCode
public function canAuthenticate($name) {
$db = \Drupal::database();
$result = $db
->select('users_field_data', 'ud')
->fields('ud', array(
'name',
))
->condition('uid', 1)
->execute()
->fetchField();
if ($result == $name) {
return FALSE;
}
return TRUE;
}