public function SimpleLdapServer::getServerType in Simple LDAP 8
Attempts to detect the directory type using the rootDSE.
Return value
string The server type: OpenLDAP, Active Directory, or LDAP.
File
- src/
SimpleLdapServer.php, line 216
Class
Namespace
Drupal\simple_ldapCode
public function getServerType() {
if (isset($this->type)) {
return $this->type;
}
if (empty($this->rootdse) && $this->ldap
->isBound()) {
$this
->setRootDse();
}
// Check for OpenLDAP.
if (isset($this->rootdse['objectclass']) && is_array($this->rootdse['objectclass'])) {
if (in_array('OpenLDAProotDSE', $this->rootdse['objectclass'])) {
$this->type = 'OpenLDAP';
return $this->type;
}
}
// Check for Active Directory.
if (isset($this->rootdse['rootdomainnamingcontext'])) {
$this->type = 'Active Directory';
return $this->type;
}
// Default to generic LDAPv3.
$this->type = 'LDAP';
return $this->type;
}