category Zend
package Zend_Ldap

 Methods

Constructor.

__construct(array | \Traversable $options) 

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, string $password) : \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.

connect(string $host, int $port, bool $useSsl, bool $useStartTls, int $networkTimeout) : \Zend\Ldap\Ldap

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.

Parameters

$host

string

The hostname of the LDAP server to connect to

$port

int

The port number of the LDAP server to connect to

$useSsl

bool

Use SSL

$useStartTls

bool

Use STARTTLS

$networkTimeout

int

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, bool $recursively) : \Zend\Ldap\Ldap

Parameters

$from

string\Zend\Ldap\Dn

$to

string\Zend\Ldap\Dn

$recursively

bool

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, bool $recursively) : \Zend\Ldap\Ldap

Parameters

$from

string\Zend\Ldap\Dn

$to

string\Zend\Ldap\Dn

$recursively

bool

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, integer $scope) : integer

Parameters

$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, bool $recursively) : \Zend\Ldap\Ldap

Parameters

$dn

string\Zend\Ldap\Dn

$recursively

bool

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) : bool

Parameters

$dn

string\Zend\Ldap\Dn

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

bool

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

Get the currently bound user

getBoundUser() : bool | 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

boolnullstring

getCanonicalAccountName()

getCanonicalAccountName(string $acctname, int $form) : string

Parameters

$acctname

string

The name to canonicalize

$form

int

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, bool $throwOnNotFound) : array

Parameters

$dn

string\Zend\Ldap\Dn

$attributes

array

$throwOnNotFound

bool

Exceptions

null\Zend\Ldap\Exception\LdapException

Returns

array

Return the LDAP error message of the last LDAP command

getLastError(int $errorCode, array $errorMessages) : string

Parameters

$errorCode

int

$errorMessages

array

Returns

string

Return the LDAP error number of the last LDAP command

getLastErrorCode() : int

Returns

int

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

getOptions()

getOptions() : array

Returns

arrayThe current options.

getResource()

getResource() : resource

Returns

resourceThe raw LDAP extension resource.

Returns the RootDse

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

Returns the schema

getSchema() : \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, bool $recursively, bool $alwaysEmulate) : \Zend\Ldap\Ldap

This is an alias for rename()

Parameters

$from

string\Zend\Ldap\Dn

$to

string\Zend\Ldap\Dn

$recursively

bool

$alwaysEmulate

bool

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, bool $recursively, bool $alwaysEmulate) : \Zend\Ldap\Ldap

Parameters

$from

string\Zend\Ldap\Dn

$to

string\Zend\Ldap\Dn

$recursively

bool

$alwaysEmulate

bool

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

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, bool $recursively, bool $alwaysEmulate) : \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

bool

$alwaysEmulate

bool

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, integer $scope, array $attributes, string | null $sort, bool $reverseSort, integer $sizelimit, integer $timelimit) : 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

$basedn

string\Zend\Ldap\Dnnull

$scope

integer

$attributes

array

$sort

stringnull

$reverseSort

bool

$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

$collectionClass

stringnull

Exceptions

\Zend\Ldap\Exception\LdapException

Returns

getAccount()

getAccount(string $acctname, array $attrs) : 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() : bool

Returns

boolAllow empty passwords

getBindRequiresDn()

getBindRequiresDn() : bool

Returns

boolBind 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 {@see delete()} or {@see 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() : int

Returns

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

getOptReferrals()

getOptReferrals() : bool

Returns

boolOpt. Referrals

getPassword()

getPassword() : string

Returns

stringThe default password for binding

getPort()

getPort() : int

Returns

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

getTryUsernameSplit()

getTryUsernameSplit() : bool

Returns

boolTry splitting the username into username and domain

getUseSsl()

getUseSsl() : bool

Returns

boolThe default SSL / TLS encrypted transport control

getUseStartTls()

getUseStartTls() : bool

Returns

boolThe default SSL / TLS encrypted transport control

getUsername()

getUsername() : string

Returns

stringThe default acctname for binding

isPossibleAuthority()

isPossibleAuthority(string $dname) : bool

Parameters

$dname

string

The domain name to check

Returns

bool

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 : bool | null | string

 

The options used in connecting, binding, etc.

$options : array

 

The raw LDAP extension resource.

$resource : resource

 

Caches the RootDse

$rootDse : \Zend\Ldap\Node\RootDse

 

Caches the schema

$schema : \Zend\Ldap\Node\Schema

 

String used with ldap_connect for error handling purposes.

$connectString : string

 Constants

 

ACCTNAME_FORM_BACKSLASH

ACCTNAME_FORM_BACKSLASH 

 

ACCTNAME_FORM_DN

ACCTNAME_FORM_DN 

 

ACCTNAME_FORM_PRINCIPAL

ACCTNAME_FORM_PRINCIPAL 

 

ACCTNAME_FORM_USERNAME

ACCTNAME_FORM_USERNAME 

 

SEARCH_SCOPE_BASE

SEARCH_SCOPE_BASE 

 

SEARCH_SCOPE_ONE

SEARCH_SCOPE_ONE 

 

SEARCH_SCOPE_SUB

SEARCH_SCOPE_SUB