mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-24 06:14:25 +02:00
parent
276aa43aa2
commit
cf8b760ade
@ -154,19 +154,17 @@ class LdapResourceForm extends Form
|
|||||||
*/
|
*/
|
||||||
public static function isValidResource(Form $form)
|
public static function isValidResource(Form $form)
|
||||||
{
|
{
|
||||||
try {
|
$result = ResourceFactory::createResource(new ConfigObject($form->getValues()))->inspect();
|
||||||
$resource = ResourceFactory::createResource(new ConfigObject($form->getValues()));
|
if ($result->hasError()) {
|
||||||
$resource->bind();
|
$form->addError(sprintf(
|
||||||
} catch (Exception $e) {
|
'%s (%s)',
|
||||||
$msg = $form->translate('Connectivity validation failed, connection to the given resource not possible.');
|
$form->translate('Connectivity validation failed, connection to the given resource not possible.'),
|
||||||
if (($error = $e->getMessage())) {
|
$result->getError()
|
||||||
$msg .= ' (' . $error . ')';
|
));
|
||||||
}
|
|
||||||
|
|
||||||
$form->addError($msg);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
// TODO: display diagnostics in $result->toArray() to the user
|
||||||
|
|
||||||
|
return ! $result->hasError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -945,7 +945,7 @@ class LdapConnection implements Selectable, Inspectable
|
|||||||
/**
|
/**
|
||||||
* Prepare and establish a connection with the LDAP server
|
* Prepare and establish a connection with the LDAP server
|
||||||
*
|
*
|
||||||
* @param Inspection $info Optional inspection to fill with diagnosis info
|
* @param Inspection $info Optional inspection to fill with diagnostic info
|
||||||
*
|
*
|
||||||
* @return resource A LDAP link identifier
|
* @return resource A LDAP link identifier
|
||||||
*
|
*
|
||||||
@ -1090,6 +1090,9 @@ class LdapConnection implements Selectable, Inspectable
|
|||||||
/**
|
/**
|
||||||
* Inspect if this LDAP Connection is working as expected
|
* Inspect if this LDAP Connection is working as expected
|
||||||
*
|
*
|
||||||
|
* Check if connection, bind and encryption is working as expected and get additional
|
||||||
|
* information about the used
|
||||||
|
*
|
||||||
* @return Inspection Inspection result
|
* @return Inspection Inspection result
|
||||||
*/
|
*/
|
||||||
public function inspect()
|
public function inspect()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user