parent
276aa43aa2
commit
cf8b760ade
|
@ -154,19 +154,17 @@ class LdapResourceForm extends Form
|
|||
*/
|
||||
public static function isValidResource(Form $form)
|
||||
{
|
||||
try {
|
||||
$resource = ResourceFactory::createResource(new ConfigObject($form->getValues()));
|
||||
$resource->bind();
|
||||
} catch (Exception $e) {
|
||||
$msg = $form->translate('Connectivity validation failed, connection to the given resource not possible.');
|
||||
if (($error = $e->getMessage())) {
|
||||
$msg .= ' (' . $error . ')';
|
||||
}
|
||||
|
||||
$form->addError($msg);
|
||||
return false;
|
||||
$result = ResourceFactory::createResource(new ConfigObject($form->getValues()))->inspect();
|
||||
if ($result->hasError()) {
|
||||
$form->addError(sprintf(
|
||||
'%s (%s)',
|
||||
$form->translate('Connectivity validation failed, connection to the given resource not possible.'),
|
||||
$result->getError()
|
||||
));
|
||||
}
|
||||
|
||||
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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
|
@ -1090,6 +1090,9 @@ class LdapConnection implements Selectable, Inspectable
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
public function inspect()
|
||||
|
|
Loading…
Reference in New Issue