Call extended backend health checks when creating ldap authentication backends
fixes #6457
This commit is contained in:
parent
6c82cb8988
commit
c42c7977be
|
@ -179,9 +179,12 @@ class LdapBackendForm extends BaseBackendForm
|
|||
$backendConfig->user_class,
|
||||
$backendConfig->user_name_attribute
|
||||
);
|
||||
$testConn->assertAuthenticationPossible();
|
||||
/*
|
||||
if ($testConn->count() === 0) {
|
||||
throw new Exception('No Users Found On Directory Server');
|
||||
}
|
||||
*/
|
||||
} catch (Exception $exc) {
|
||||
$this->addErrorMessage(
|
||||
t('Connection Validation Failed: ' . $exc->getMessage())
|
||||
|
|
|
@ -87,15 +87,15 @@ class LdapUserBackend extends UserBackend
|
|||
*
|
||||
* @throws AuthenticationException When authentication is not possible
|
||||
*/
|
||||
protected function assertAuthenticationPossible()
|
||||
public function assertAuthenticationPossible()
|
||||
{
|
||||
$q = $this->conn->select()->from($this->userClass);
|
||||
$result = $q->fetchRow();
|
||||
if (!isset($result)) {
|
||||
throw new AuthenticationException(
|
||||
sprintf('No users with objectClass="%s" in DN="%s" available',
|
||||
sprintf('No objects with objectClass="%s" in DN="%s" found.',
|
||||
$this->userClass,
|
||||
$this->userNameAttribute
|
||||
$this->conn->getDN()
|
||||
));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue