Remove hardcoded use of default LDAP server, added example for opendj

This commit is contained in:
2025-01-22 15:27:52 +11:00
parent 16452ebfa9
commit 3a4b0bfe05
3 changed files with 22 additions and 5 deletions

View File

@@ -59,14 +59,14 @@ final class Server
* Gets the root DN of the specified LDAPServer, or throws an exception if it
* can't find it.
*
* @param null $connection Return a collection of baseDNs
* @param string|null $connection Return a collection of baseDNs
* @param bool $objects Return a collection of Entry Models
* @return Collection
* @throws ObjectNotFoundException
* @testedin GetBaseDNTest::testBaseDNExists();
* @todo Need to allow for the scenario if the baseDN is not readable by ACLs
*/
public static function baseDNs(string $connection='default',bool $objects=TRUE): Collection
public static function baseDNs(string $connection=NULL,bool $objects=TRUE): Collection
{
$cachetime = Carbon::now()
->addSeconds(Config::get('ldap.cache.time'));
@@ -360,9 +360,13 @@ final class Server
}
// Try to get the schema DN from the specified entry.
$schema_dn = $this->schemaDN('default');
$schema_dn = $this->schemaDN($this->connection);
$schema = $this->fetch($schema_dn);
// If our schema's null, we didnt find it.
if (! $schema)
throw new Exception('Couldnt find schema at:'.$schema_dn);
switch ($item) {
case 'attributetypes':
Log::debug('Attribute Types');