Wizard: show LDAP connection settings discovery failure reasons
refs #2865
This commit is contained in:
parent
c22efa4519
commit
d13856eb39
|
@ -81,6 +81,16 @@ class Discovery
|
|||
return $this->connection->discoverySuccessful();
|
||||
}
|
||||
|
||||
/**
|
||||
* Why the discovery failed
|
||||
*
|
||||
* @return \Exception|null
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
return $this->connection->getDiscoveryError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Discover LDAP servers on the given domain
|
||||
*
|
||||
|
|
|
@ -153,6 +153,13 @@ class LdapConnection implements Selectable, Inspectable
|
|||
*/
|
||||
protected $discoverySuccess;
|
||||
|
||||
/**
|
||||
* The cause of the discovery's failure
|
||||
*
|
||||
* @var Exception|null
|
||||
*/
|
||||
private $discoveryError;
|
||||
|
||||
/**
|
||||
* Whether the current connection is encrypted
|
||||
*
|
||||
|
@ -250,11 +257,13 @@ class LdapConnection implements Selectable, Inspectable
|
|||
try {
|
||||
$this->capabilities = LdapCapabilities::discoverCapabilities($this);
|
||||
$this->discoverySuccess = true;
|
||||
$this->discoveryError = null;
|
||||
} catch (LdapException $e) {
|
||||
Logger::debug($e);
|
||||
Logger::warning('LADP discovery failed, assuming default LDAP capabilities.');
|
||||
$this->capabilities = new LdapCapabilities(); // create empty default capabilities
|
||||
$this->discoverySuccess = false;
|
||||
$this->discoveryError = $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -275,6 +284,16 @@ class LdapConnection implements Selectable, Inspectable
|
|||
return $this->discoverySuccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get discovery error if any
|
||||
*
|
||||
* @return Exception|null
|
||||
*/
|
||||
public function getDiscoveryError()
|
||||
{
|
||||
return $this->discoveryError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether the current connection is encrypted
|
||||
*
|
||||
|
|
|
@ -74,6 +74,8 @@ class LdapDiscoveryPage extends Form
|
|||
$this->discovery = Discovery::discoverDomain($data['domain']);
|
||||
if ($this->discovery->isSuccess()) {
|
||||
return true;
|
||||
} else {
|
||||
$this->error($this->discovery->getError()->getMessage());
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->error(sprintf(
|
||||
|
|
Loading…
Reference in New Issue