Call extended backend health checks when creating ldap authentication backends

fixes #6457
This commit is contained in:
Matthias Jentsch 2014-06-11 15:04:19 +02:00
parent 6c82cb8988
commit c42c7977be
2 changed files with 6 additions and 3 deletions

View File

@ -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())

View File

@ -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()
));
}