lib/LDAP: Add fetchByDn for a base scope retrieval on an entry
refs #11485
This commit is contained in:
parent
202d61dd4e
commit
955a9482ad
|
@ -6,6 +6,7 @@ namespace Icinga\Protocol\Ldap;
|
||||||
use Exception;
|
use Exception;
|
||||||
use LogicException;
|
use LogicException;
|
||||||
use ArrayIterator;
|
use ArrayIterator;
|
||||||
|
use stdClass;
|
||||||
use Icinga\Application\Config;
|
use Icinga\Application\Config;
|
||||||
use Icinga\Application\Logger;
|
use Icinga\Application\Logger;
|
||||||
use Icinga\Data\ConfigObject;
|
use Icinga\Data\ConfigObject;
|
||||||
|
@ -549,6 +550,23 @@ class LdapConnection implements Selectable, Inspectable
|
||||||
return $pairs;
|
return $pairs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch an LDAP entry by its DN
|
||||||
|
*
|
||||||
|
* @param string $dn
|
||||||
|
* @param array|null $fields
|
||||||
|
*
|
||||||
|
* @return StdClass|bool
|
||||||
|
*/
|
||||||
|
public function fetchByDn($dn, array $fields = null)
|
||||||
|
{
|
||||||
|
return $this->select()
|
||||||
|
->from('*', $fields)
|
||||||
|
->setBase($dn)
|
||||||
|
->setScope('base')
|
||||||
|
->fetchRow();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the given LDAP credentials by establishing a connection and attempting a LDAP bind
|
* Test the given LDAP credentials by establishing a connection and attempting a LDAP bind
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue