package Default

 Methods

Constructor.

__construct(array|\Traversable $options = array()

Parameters

$options

array\Traversable

Options used in connecting, binding, etc.

Exceptions

\Zend\Ldap\Exception\LdapException

Destructor.

__destruct() : void

Add new information to the LDAP repository

add(string|\Zend\Ldap\Dn $dn, array $entry) : \Zend\Ldap\Ldap

Parameters

$dn

string\Zend\Ldap\Dn

$entry

array

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\LdapProvides a fluid interface

bind()

bind(string $username = null, string $password = null) : \Zend\Ldap\Ldap

Parameters

$username

string

The username for authenticating the bind

$password

string

The password for authenticating the bind

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\LdapProvides a fluent interface

To connect using SSL it seems the client tries to verify the server certificate by default. One way to disable this behavior is to set 'TLS_REQCERT never' in OpenLDAP's ldap.conf and restarting Apache. Or, if you really care about the server's cert you can put a cert on the web server.

connect(string $host = null, integer $port = null, boolean $useSsl = null, boolean $useStartTls = null, integer $networkTimeout = null) : \Zend\Ldap\Ldap

Parameters

$host

string

The hostname of the LDAP server to connect to

$port

integer

The port number of the LDAP server to connect to

$useSsl

boolean

Use SSL

$useStartTls

boolean

Use STARTTLS

$networkTimeout

integer

The value for network timeout when connect to the LDAP server.

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\LdapProvides a fluent interface

Copies a LDAP entry from one DN to another DN.

copy(string|\Zend\Ldap\Dn $from, string|\Zend\Ldap\Dn $to, boolean $recursively = false) : \Zend\Ldap\Ldap

Parameters

$from

string\Zend\Ldap\Dn

$to

string\Zend\Ldap\Dn

$recursively

boolean

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\LdapProvides a fluid interface

Copies a LDAP entry from one DN to another subtree.

copyToSubtree(string|\Zend\Ldap\Dn $from, string|\Zend\Ldap\Dn $to, boolean $recursively = false) : \Zend\Ldap\Ldap

Parameters

$from

string\Zend\Ldap\Dn

$to

string\Zend\Ldap\Dn

$recursively

boolean

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\LdapProvides a fluid interface

Count items found by given filter.

count(string|\Zend\Ldap\Filter\AbstractFilter $filter, string|\Zend\Ldap\Dn|null $basedn = null, integer $scope = self::SEARCH_SCOPE_SUB) : integer

Parameters

$filter

string\Zend\Ldap\Filter\AbstractFilter

$basedn

string\Zend\Ldap\Dnnull

$scope

integer

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

integer

Count children for a given DN.

countChildren(string|\Zend\Ldap\Dn $dn) : integer

Parameters

$dn

string\Zend\Ldap\Dn

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

integer

Delete an LDAP entry

delete(string|\Zend\Ldap\Dn $dn, boolean $recursively = false) : \Zend\Ldap\Ldap

Parameters

$dn

string\Zend\Ldap\Dn

$recursively

boolean

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\LdapProvides a fluid interface

disconnect()

disconnect() : \Zend\Ldap\Ldap

Returns

\Zend\Ldap\LdapProvides a fluent interface

Check if a given DN exists.

exists(string|\Zend\Ldap\Dn $dn) : boolean

Parameters

$dn

string\Zend\Ldap\Dn

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

boolean

Gets the base DN under which objects of interest are located

getBaseDn() : string

Returns

string

Returns the base node as a Zend\Ldap\Node

getBaseNode() : \Zend\Ldap\Node

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\Node

Get the currently bound user

getBoundUser() : boolean | null | string

FALSE if no user is bound to the LDAP resource NULL if there has been an anonymous bind username of the currently bound user

Returns

booleannullstring

getCanonicalAccountName()

getCanonicalAccountName(string $acctname, integer $form = 0) : string

Parameters

$acctname

string

The name to canonicalize

$form

integer

The desired form of canonicalization

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

stringThe canonicalized name in the desired form

Get LDAP entry by DN

getEntry(string|\Zend\Ldap\Dn $dn, array $attributes = array(), boolean $throwOnNotFound = false) : array

Parameters

$dn

string\Zend\Ldap\Dn

$attributes

array

$throwOnNotFound

boolean

Exceptions

null\Zend\Ldap\Exception\LdapException

Returns

array

Return the LDAP error message of the last LDAP command

getLastError(integer $errorCode = null, array $errorMessages = null) : string

Parameters

$errorCode

integer

$errorMessages

array

Returns

string

Return the LDAP error number of the last LDAP command

getLastErrorCode() : integer

Returns

integer

Returns the specified DN as a Zend\Ldap\Node

getNode(string|\Zend\Ldap\Dn $dn) : \Zend\Ldap\Node | null

Parameters

$dn

string\Zend\Ldap\Dn

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\Nodenull

getOptions()

getOptions() : array

Returns

arrayThe current options.

getResource()

getResource() : resource

Returns

resourceThe raw LDAP extension resource.

Returns the RootDse

getRootDse() : \Zend\Ldap\Node\RootDse

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\Node\RootDse

Returns the schema

getSchema() : \Zend\Ldap\Node\Schema

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\Node\Schema

Moves a LDAP entry from one DN to another DN.

move(string|\Zend\Ldap\Dn $from, string|\Zend\Ldap\Dn $to, boolean $recursively = false, boolean $alwaysEmulate = false) : \Zend\Ldap\Ldap

This is an alias for \rename()

Parameters

$from

string\Zend\Ldap\Dn

$to

string\Zend\Ldap\Dn

$recursively

boolean

$alwaysEmulate

boolean

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\LdapProvides a fluid interface

Moves a LDAP entry from one DN to another subtree.

moveToSubtree(string|\Zend\Ldap\Dn $from, string|\Zend\Ldap\Dn $to, boolean $recursively = false, boolean $alwaysEmulate = false) : \Zend\Ldap\Ldap

Parameters

$from

string\Zend\Ldap\Dn

$to

string\Zend\Ldap\Dn

$recursively

boolean

$alwaysEmulate

boolean

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\LdapProvides a fluid interface

Prepares an ldap data entry array for insert/update operation

prepareLdapEntryArray(array $entry) : void
Static

Parameters

$entry

array

Exceptions

\Zend\Ldap\Exception\InvalidArgumentException

Renames a LDAP entry from one DN to another DN.

rename(string|\Zend\Ldap\Dn $from, string|\Zend\Ldap\Dn $to, boolean $recursively = false, boolean $alwaysEmulate = false) : \Zend\Ldap\Ldap

This method implicitly moves the entry to another location within the tree.

Parameters

$from

string\Zend\Ldap\Dn

$to

string\Zend\Ldap\Dn

$recursively

boolean

$alwaysEmulate

boolean

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\LdapProvides a fluid interface

Save entry to LDAP registry.

save(string|\Zend\Ldap\Dn $dn, array $entry) : \Zend\Ldap\Ldap

Internally decides if entry will be updated to added by calling \exists().

Parameters

$dn

string\Zend\Ldap\Dn

$entry

array

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\LdapProvides a fluid interface

Search LDAP registry for entries matching filter and optional attributes

searchEntries(string|\Zend\Ldap\Filter\AbstractFilter|array $filter, string|\Zend\Ldap\Dn|null $basedn = null, integer $scope = self::SEARCH_SCOPE_SUB, array $attributes = array(), string|null $sort = null, boolean $reverseSort = false, integer $sizelimit = 0, integer $timelimit = 0) : array

Options can be either passed as single parameters according to the method signature or as an array with one or more of the following keys

  • filter
  • baseDn
  • scope
  • attributes
  • sort
  • reverseSort
  • sizelimit
  • timelimit

Parameters

$filter

string\Zend\Ldap\Filter\AbstractFilterarray

$basedn

string\Zend\Ldap\Dnnull

$scope

integer

$attributes

array

$sort

stringnull

$reverseSort

boolean

$sizelimit

integer

$timelimit

integer

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

array

Sets the options used in connecting, binding, etc.

setOptions(array|\Traversable $options) : \Zend\Ldap\Ldap

Valid option keys: host port useSsl username password bindRequiresDn baseDn accountCanonicalForm accountDomainName accountDomainNameShort accountFilterFormat allowEmptyPassword useStartTls optReferrals tryUsernameSplit networkTimeout

Parameters

$options

array\Traversable

Options used in connecting, binding, etc.

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\LdapProvides a fluent interface

Update LDAP registry

update(string|\Zend\Ldap\Dn $dn, array $entry) : \Zend\Ldap\Ldap

Parameters

$dn

string\Zend\Ldap\Dn

$entry

array

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\LdapProvides a fluid interface

Extension point for collection creation

createCollection(\Zend\Ldap\Collection\DefaultIterator $iterator, string|null $collectionClass) : \Zend\Ldap\Collection

Parameters

$iterator

\Zend\Ldap\Collection\DefaultIterator

$collectionClass

stringnull

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

\Zend\Ldap\Collection

getAccount()

getAccount(string $acctname, array $attrs = null) : array

Parameters

$acctname

string

$attrs

array

An array of names of desired attributes

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

arrayAn array of the attributes representing the account

getAccountCanonicalForm()

getAccountCanonicalForm() : integer

Returns

integerEither ACCTNAME_FORM_BACKSLASH, ACCTNAME_FORM_PRINCIPAL or ACCTNAME_FORM_USERNAME indicating the form usernames should be canonicalized to.

getAccountDn()

getAccountDn(string $acctname) : string

Parameters

$acctname

string

The name of the account

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

stringThe DN of the specified account

getAccountDomainName()

getAccountDomainName() : string

Returns

stringThe account domain name

getAccountDomainNameShort()

getAccountDomainNameShort() : string

Returns

stringThe short account domain name

getAccountFilter()

getAccountFilter(string $acctname) : string

Parameters

$acctname

string

Returns

stringThe LDAP search filter for matching directory accounts

getAccountFilterFormat()

getAccountFilterFormat() : string

Returns

stringA format string for building an LDAP search filter to match an account

getAllowEmptyPassword()

getAllowEmptyPassword() : boolean

Returns

booleanAllow empty passwords

getBindRequiresDn()

getBindRequiresDn() : boolean

Returns

booleanBind requires DN

Retrieve the immediate children DNs of the given $parentDn

getChildrenDns(string|\Zend\Ldap\Dn $parentDn) : array

This method is used in recursive methods like \delete() or \copy()

Parameters

$parentDn

string\Zend\Ldap\Dn

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

arrayof DNs

getHost()

getHost() : string

Returns

stringThe hostname of the LDAP server being used to authenticate accounts

getNetworkTimeout()

getNetworkTimeout() : integer

Returns

integerThe value for network timeout when connect to the LDAP server.

getOptReferrals()

getOptReferrals() : boolean

Returns

booleanOpt. Referrals

getPassword()

getPassword() : string

Returns

stringThe default password for binding

getPort()

getPort() : integer

Returns

integerThe port of the LDAP server or 0 to indicate that no port value is set

getTryUsernameSplit()

getTryUsernameSplit() : boolean

Returns

booleanTry splitting the username into username and domain

getUseSsl()

getUseSsl() : boolean

Returns

booleanThe default SSL / TLS encrypted transport control

getUseStartTls()

getUseStartTls() : boolean

Returns

booleanThe default SSL / TLS encrypted transport control

getUsername()

getUsername() : string

Returns

stringThe default acctname for binding

isPossibleAuthority()

isPossibleAuthority(string $dname) : boolean

Parameters

$dname

string

The domain name to check

Returns

boolean

splitName()

splitName(string $name, string $dname, string $aname) : void

Parameters

$name

string

The name to split

$dname

string

The resulting domain name (this is an out parameter)

$aname

string

The resulting account name (this is an out parameter)

 Properties

 

FALSE if no user is bound to the LDAP resource NULL if there has been an anonymous bind username of the currently bound user

$boundUser : boolean | null | string

Default

false
 

The options used in connecting, binding, etc.

$options : array

Default

null
 

The raw LDAP extension resource.

$resource : resource

Default

null
 

Caches the RootDse

$rootDse : \Zend\Ldap\Node\RootDse

Default

null
 

Caches the schema

$schema : \Zend\Ldap\Node\Schema

Default

null
 

String used with ldap_connect for error handling purposes.

$connectString : string

Default

 Constants

 

ACCTNAME_FORM_BACKSLASH

ACCTNAME_FORM_BACKSLASH = 3 
 

ACCTNAME_FORM_DN

ACCTNAME_FORM_DN = 1 
 

ACCTNAME_FORM_PRINCIPAL

ACCTNAME_FORM_PRINCIPAL = 4 
 

ACCTNAME_FORM_USERNAME

ACCTNAME_FORM_USERNAME = 2 
 

SEARCH_SCOPE_BASE

SEARCH_SCOPE_BASE = 3 
 

SEARCH_SCOPE_ONE

SEARCH_SCOPE_ONE = 2 
 

SEARCH_SCOPE_SUB

SEARCH_SCOPE_SUB = 1