mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
LdapBackendForm: Fail gracefully if the discovery is not possible
This commit is contained in:
parent
d2467fee16
commit
5411efd546
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Forms\Config\UserBackend;
|
namespace Icinga\Forms\Config\UserBackend;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use Icinga\Data\ResourceFactory;
|
use Icinga\Data\ResourceFactory;
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
|
|
||||||
@ -123,9 +124,17 @@ class LdapBackendForm extends Form
|
|||||||
$connection = ResourceFactory::create(
|
$connection = ResourceFactory::create(
|
||||||
isset($formData['resource']) ? $formData['resource'] : reset($this->resources)
|
isset($formData['resource']) ? $formData['resource'] : reset($this->resources)
|
||||||
);
|
);
|
||||||
$capabilities = $connection->bind()->getCapabilities();
|
|
||||||
$baseDn = $capabilities->getDefaultNamingContext();
|
try {
|
||||||
$hasAdOid = $capabilities->isActiveDirectory();
|
$capabilities = $connection->bind()->getCapabilities();
|
||||||
|
$baseDn = $capabilities->getDefaultNamingContext();
|
||||||
|
$hasAdOid = $capabilities->isActiveDirectory();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->warning(sprintf(
|
||||||
|
$this->translate('Failed to discover the chosen LDAP connection: %s'),
|
||||||
|
$e->getMessage()
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user