mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 07:14:35 +02:00
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_class,
|
||||||
$backendConfig->user_name_attribute
|
$backendConfig->user_name_attribute
|
||||||
);
|
);
|
||||||
|
$testConn->assertAuthenticationPossible();
|
||||||
|
/*
|
||||||
if ($testConn->count() === 0) {
|
if ($testConn->count() === 0) {
|
||||||
throw new Exception('No Users Found On Directory Server');
|
throw new Exception('No Users Found On Directory Server');
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
} catch (Exception $exc) {
|
} catch (Exception $exc) {
|
||||||
$this->addErrorMessage(
|
$this->addErrorMessage(
|
||||||
t('Connection Validation Failed: ' . $exc->getMessage())
|
t('Connection Validation Failed: ' . $exc->getMessage())
|
||||||
|
@ -87,15 +87,15 @@ class LdapUserBackend extends UserBackend
|
|||||||
*
|
*
|
||||||
* @throws AuthenticationException When authentication is not possible
|
* @throws AuthenticationException When authentication is not possible
|
||||||
*/
|
*/
|
||||||
protected function assertAuthenticationPossible()
|
public function assertAuthenticationPossible()
|
||||||
{
|
{
|
||||||
$q = $this->conn->select()->from($this->userClass);
|
$q = $this->conn->select()->from($this->userClass);
|
||||||
$result = $q->fetchRow();
|
$result = $q->fetchRow();
|
||||||
if (!isset($result)) {
|
if (!isset($result)) {
|
||||||
throw new AuthenticationException(
|
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->userClass,
|
||||||
$this->userNameAttribute
|
$this->conn->getDN()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user