- Updated to match Notes-2.x

This commit is contained in:
mcndave committed 2024-10-10 13:38:28 -04:00
1 parent 4b9a162696
commit 5cd0d13404
14 files changed
+243 -70

No files matched your search

+12 -11
View File
@@ -9,6 +9,7 @@ use Ulmus\{Adapter\AdapterInterface,
Migration\FieldDefinition,
Ulmus};
use LDAP\Result;
use Ulmus\Ldap\Common\LdapObject;
use function ldap_set_option, ldap_start_tls, ldap_bind, ldap_unbind, ldap_connect, ldap_close, ldap_get_entries;
@@ -28,15 +29,15 @@ class Ldap implements \Ulmus\Adapter\AdapterInterface {
public bool $encrypt;
public bool $forceSSL = false;
public array $hosts;
public string $baseDn;
public string $username;
public string $password;
public string $accountSuffix;
public string $pathCertCrt;
@@ -73,11 +74,11 @@ class Ldap implements \Ulmus\Adapter\AdapterInterface {
}
}
public function authenticate(string $dn, string $password) : bool
public function authenticate(string $dn, string $password) : false|Result
{
$this->ldapObject = $this->getLdapObject();
return $this->ldapObject->bind($dn, $password);;
return $this->ldapObject->bind($dn, $password);
}
public function connect() : object
@@ -92,7 +93,7 @@ class Ldap implements \Ulmus\Adapter\AdapterInterface {
public function bindUser() : void
{
if ( ! $this->ldapObject->bind($this->username, $this->password) ) {
throw new \Exception("LDAP bind failed with given user $usr.");
throw new \Exception("LDAP bind failed with given user {$this->username}.");
}
}
@@ -118,7 +119,7 @@ class Ldap implements \Ulmus\Adapter\AdapterInterface {
elseif ($this->forceSSL) {
$ldapObject->startTLS();
}
return $ldapObject;
}
@@ -126,11 +127,11 @@ class Ldap implements \Ulmus\Adapter\AdapterInterface {
{
return "";
}
public function setup(array $configuration) : void
{
$configuration = array_change_key_case($configuration, \CASE_LOWER);
if ( false === ( $this->hosts = $configuration['hosts'] ?? false ) ) {
throw new AdapterConfigurationException("Your `host` setting is missing. It is a mandatory parameter for this driver.");
}
@@ -166,7 +167,7 @@ class Ldap implements \Ulmus\Adapter\AdapterInterface {
return $value;
}
public function escapeIdentifier(string $segment, int $type, string $ignore = "") : string
{
switch($type) {