Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes

Zend_Ldap Class Reference

Public Member Functions

 __construct ($options=array())
 __destruct ()
 getResource ()
 getLastErrorCode ()
 getLastError (&$errorCode=null, array &$errorMessages=null)
 setOptions ($options)
 getOptions ()
 getBaseDn ()
 getCanonicalAccountName ($acctname, $form=0)
 disconnect ()
 connect ($host=null, $port=null, $useSsl=null, $useStartTls=null)
 bind ($username=null, $password=null)
 search ($filter, $basedn=null, $scope=self::SEARCH_SCOPE_SUB, array $attributes=array(), $sort=null, $collectionClass=null)
 count ($filter, $basedn=null, $scope=self::SEARCH_SCOPE_SUB)
 countChildren ($dn)
 exists ($dn)
 searchEntries ($filter, $basedn=null, $scope=self::SEARCH_SCOPE_SUB, array $attributes=array(), $sort=null)
 getEntry ($dn, array $attributes=array(), $throwOnNotFound=false)
 add ($dn, array $entry)
 update ($dn, array $entry)
 save ($dn, array $entry)
 delete ($dn, $recursively=false)
 moveToSubtree ($from, $to, $recursively=false, $alwaysEmulate=false)
 move ($from, $to, $recursively=false, $alwaysEmulate=false)
 rename ($from, $to, $recursively=false, $alwaysEmulate=false)
 copyToSubtree ($from, $to, $recursively=false)
 copy ($from, $to, $recursively=false)
 getNode ($dn)
 getBaseNode ()
 getRootDse ()
 getSchema ()

Static Public Member Functions

static filterEscape ($str)
static explodeDn ($dn, array &$keys=null, array &$vals=null)
static prepareLdapEntryArray (array &$entry)

Data Fields

const SEARCH_SCOPE_SUB = 1
const SEARCH_SCOPE_ONE = 2
const SEARCH_SCOPE_BASE = 3
const ACCTNAME_FORM_DN = 1
const ACCTNAME_FORM_USERNAME = 2
const ACCTNAME_FORM_BACKSLASH = 3
const ACCTNAME_FORM_PRINCIPAL = 4

Protected Member Functions

 _getHost ()
 _getPort ()
 _getUseSsl ()
 _getUsername ()
 _getPassword ()
 _getBindRequiresDn ()
 _getAccountCanonicalForm ()
 _getAccountDomainName ()
 _getAccountDomainNameShort ()
 _getAccountFilterFormat ()
 _getAllowEmptyPassword ()
 _getUseStartTls ()
 _getOptReferrals ()
 _getTryUsernameSplit ()
 _getAccountFilter ($acctname)
 _splitName ($name, &$dname, &$aname)
 _getAccountDn ($acctname)
 _isPossibleAuthority ($dname)
 _getAccount ($acctname, array $attrs=null)
 _getChildrenDns ($parentDn)

Protected Attributes

 $_options = null
 $_resource = null
 $_rootDse = null
 $_schema = null

Detailed Description

Definition at line 29 of file Ldap.php.


Constructor & Destructor Documentation

__construct ( options = array() )

Constructor.

Parameters:
array | Zend_Config$optionsOptions used in connecting, binding, etc.
Returns:
void

Definition at line 112 of file Ldap.php.

__destruct (  )

Destructor.

Returns:
void

Definition at line 122 of file Ldap.php.


Member Function Documentation

_getAccount ( acctname,
array $  attrs = null 
) [protected]
Parameters:
array$attrsAn array of names of desired attributes
Returns:
array An array of the attributes representing the account
Exceptions:
Zend_Ldap_Exception

See also:
Zend_Ldap_Exception
Zend_Ldap_Exception
Zend_Ldap_Exception
Zend_Ldap_Exception
Zend_Ldap_Exception

Definition at line 607 of file Ldap.php.

_getAccountCanonicalForm (  ) [protected]
Returns:
integer Either ACCTNAME_FORM_BACKSLASH, ACCTNAME_FORM_PRINCIPAL or ACCTNAME_FORM_USERNAME indicating the form usernames should be canonicalized to.

Definition at line 359 of file Ldap.php.

_getAccountDn ( acctname ) [protected]
Parameters:
string$acctnameThe name of the account
Returns:
string The DN of the specified account
Exceptions:
Zend_Ldap_Exception

See also:
Zend_Ldap_Dn

Definition at line 495 of file Ldap.php.

_getAccountDomainName (  ) [protected]
Returns:
string The account domain name

Definition at line 386 of file Ldap.php.

_getAccountDomainNameShort (  ) [protected]
Returns:
string The short account domain name

Definition at line 394 of file Ldap.php.

_getAccountFilter ( acctname ) [protected]
Returns:
string The LDAP search filter for matching directory accounts

See also:
Zend_Ldap_Filter_Abstract

Definition at line 443 of file Ldap.php.

_getAccountFilterFormat (  ) [protected]
Returns:
string A format string for building an LDAP search filter to match an account

Definition at line 403 of file Ldap.php.

_getAllowEmptyPassword (  ) [protected]
Returns:
boolean Allow empty passwords

Definition at line 411 of file Ldap.php.

_getBindRequiresDn (  ) [protected]
Returns:
boolean Bind requires DN

Definition at line 340 of file Ldap.php.

_getChildrenDns ( parentDn ) [protected]

Retrieve the immediate children DNs of the given $parentDn

This method is used in recursive methods like {

See also:
delete()} or {
copy()}
Parameters:
string | Zend_Ldap_Dn$parentDn
Returns:
array of DNs

See also:
Zend_Ldap_Exception

Definition at line 1236 of file Ldap.php.

_getHost (  ) [protected]
Returns:
string The hostname of the LDAP server being used to authenticate accounts

Definition at line 300 of file Ldap.php.

_getOptReferrals (  ) [protected]
Returns:
boolean Opt. Referrals

Definition at line 427 of file Ldap.php.

_getPassword (  ) [protected]
Returns:
string The default password for binding

Definition at line 332 of file Ldap.php.

_getPort (  ) [protected]
Returns:
int The port of the LDAP server or 0 to indicate that no port value is set

Definition at line 308 of file Ldap.php.

_getTryUsernameSplit (  ) [protected]
Returns:
boolean Try splitting the username into username and domain

Definition at line 435 of file Ldap.php.

_getUsername (  ) [protected]
Returns:
string The default acctname for binding

Definition at line 324 of file Ldap.php.

_getUseSsl (  ) [protected]
Returns:
boolean The default SSL / TLS encrypted transport control

Definition at line 316 of file Ldap.php.

_getUseStartTls (  ) [protected]
Returns:
boolean The default SSL / TLS encrypted transport control

Definition at line 419 of file Ldap.php.

_isPossibleAuthority ( dname ) [protected]
Parameters:
string$dnameThe domain name to check
Returns:
boolean

Definition at line 511 of file Ldap.php.

_splitName ( name,
&$  dname,
&$  aname 
) [protected]
Parameters:
string$nameThe name to split
string$dnameThe resulting domain name (this is an out parameter)
string$anameThe resulting account name (this is an out parameter)
Returns:
void

Definition at line 468 of file Ldap.php.

add ( dn,
array $  entry 
)

Add new information to the LDAP repository

Parameters:
string | Zend_Ldap_Dn$dn
array$entry
Returns:
Zend_Ldap Provides a fluid interface
Exceptions:
Zend_Ldap_Exception

See also:
Zend_Ldap_Exception

Definition at line 1096 of file Ldap.php.

bind ( username = null,
password = null 
)
Parameters:
string$usernameThe username for authenticating the bind
string$passwordThe password for authenticating the bind
Returns:
Zend_Ldap Provides a fluent interface
Exceptions:
Zend_Ldap_Exception

See also:
Zend_Ldap_Dn
Zend_Ldap_Exception
Zend_Ldap_Exception
Zend_Ldap_Exception

Definition at line 782 of file Ldap.php.

connect ( host = null,
port = null,
useSsl = null,
useStartTls = null 
)
Parameters:
string$hostThe hostname of the LDAP server to connect to
int$portThe port number of the LDAP server to connect to
boolean$useSslUse SSL
boolean$useStartTlsUse STARTTLS
Returns:
Zend_Ldap Provides a fluent interface
Exceptions:
Zend_Ldap_Exception

See also:
Zend_Ldap_Exception
Zend_Ldap_Exception
Zend_Ldap_Exception
Zend_Ldap_Exception

Definition at line 688 of file Ldap.php.

copy ( from,
to,
recursively = false 
)

Copies a LDAP entry from one DN to another DN.

Parameters:
string | Zend_Ldap_Dn$from
string | Zend_Ldap_Dn$to
boolean$recursively
Returns:
Zend_Ldap Provides a fluid interface
Exceptions:
Zend_Ldap_Exception

Definition at line 1391 of file Ldap.php.

copyToSubtree ( from,
to,
recursively = false 
)

Copies a LDAP entry from one DN to another subtree.

Parameters:
string | Zend_Ldap_Dn$from
string | Zend_Ldap_Dn$to
boolean$recursively
Returns:
Zend_Ldap Provides a fluid interface
Exceptions:
Zend_Ldap_Exception

Definition at line 1363 of file Ldap.php.

count ( filter,
basedn = null,
scope = self::SEARCH_SCOPE_SUB 
)

Count items found by given filter.

Parameters:
string | Zend_Ldap_Filter_Abstract$filter
string | Zend_Ldap_Dn | null$basedn
integer$scope
Returns:
integer
Exceptions:
Zend_Ldap_Exception

Definition at line 971 of file Ldap.php.

countChildren ( dn )

Count children for a given DN.

Parameters:
string | Zend_Ldap_Dn$dn
Returns:
integer
Exceptions:
Zend_Ldap_Exception

Definition at line 989 of file Ldap.php.

delete ( dn,
recursively = false 
)

Delete an LDAP entry

Parameters:
string | Zend_Ldap_Dn$dn
boolean$recursively
Returns:
Zend_Ldap Provides a fluid interface
Exceptions:
Zend_Ldap_Exception

See also:
Zend_Ldap_Exception

Definition at line 1203 of file Ldap.php.

disconnect (  )
Returns:
Zend_Ldap Provides a fluent interface

See also:
Zend_Ldap_Exception

Definition at line 663 of file Ldap.php.

exists ( dn )

Check if a given DN exists.

Parameters:
string | Zend_Ldap_Dn$dn
Returns:
boolean
Exceptions:
Zend_Ldap_Exception

Definition at line 1001 of file Ldap.php.

static explodeDn ( dn,
array &$  keys = null,
array &$  vals = null 
) [static]
Deprecated:
will be removed, use {
See also:
Zend_Ldap_Dn::checkDn()}
Parameters:
string$dnThe DN to parse
array$keysAn optional array to receive DN keys (e.g. CN, OU, DC, ...)
array$valsAn optional array to receive DN values
Returns:
boolean True if the DN was successfully parsed or false if the string is not a valid DN.

See also:
Zend_Ldap_Dn

Definition at line 97 of file Ldap.php.

static filterEscape ( str ) [static]
Deprecated:
will be removed, use {
See also:
Zend_Ldap_Filter_Abstract::escapeValue()}
Parameters:
string$strThe string to escape.
Returns:
string The escaped string

See also:
Zend_Ldap_Filter_Abstract

Definition at line 80 of file Ldap.php.

getBaseDn (  )

Gets the base DN under which objects of interest are located

Returns:
string

Definition at line 350 of file Ldap.php.

getBaseNode (  )

Returns the base node as a Zend_Ldap_Node

Returns:
Zend_Ldap_Node
Exceptions:
Zend_Ldap_Exception

Definition at line 1436 of file Ldap.php.

getCanonicalAccountName ( acctname,
form = 0 
)
Parameters:
string$acctnameThe name to canonicalize
int$typeThe desired form of canonicalization
Returns:
string The canonicalized name in the desired form
Exceptions:
Zend_Ldap_Exception

See also:
Zend_Ldap_Exception
Zend_Ldap_Exception
Zend_Ldap_Exception
Zend_Ldap_Exception
Zend_Ldap_Exception

Definition at line 536 of file Ldap.php.

getEntry ( dn,
array $  attributes = array(),
throwOnNotFound = false 
)

Get LDAP entry by DN

Parameters:
string | Zend_Ldap_Dn$dn
array$attributes
boolean$throwOnNotFound
Returns:
array
Exceptions:
Zend_Ldap_Exception

Definition at line 1033 of file Ldap.php.

getLastError ( &$  errorCode = null,
array &$  errorMessages = null 
)

Return the LDAP error message of the last LDAP command

Parameters:
int$errorCode
array$errorMessages
Returns:
string

Definition at line 166 of file Ldap.php.

getLastErrorCode (  )

Return the LDAP error number of the last LDAP command

Returns:
int

See also:
Zend_Ldap_Exception

Definition at line 140 of file Ldap.php.

getNode ( dn )

Returns the specified DN as a Zend_Ldap_Node

Parameters:
string | Zend_Ldap_Dn$dn
Returns:
Zend_Ldap_Node|null
Exceptions:
Zend_Ldap_Exception

Zend_Ldap_Node

Definition at line 1421 of file Ldap.php.

getOptions (  )
Returns:
array The current options.

Definition at line 292 of file Ldap.php.

getResource (  )
Returns:
resource The raw LDAP extension resource.

Definition at line 130 of file Ldap.php.

getRootDse (  )

Returns the RootDSE

Returns:
Zend_Ldap_Node_RootDse
Exceptions:
Zend_Ldap_Exception

See also:
Zend_Ldap_Node_Schema

Definition at line 1447 of file Ldap.php.

getSchema (  )

Returns the schema

Returns:
Zend_Ldap_Node_Schema
Exceptions:
Zend_Ldap_Exception

See also:
Zend_Ldap_Node_Schema

Definition at line 1465 of file Ldap.php.

move ( from,
to,
recursively = false,
alwaysEmulate = false 
)

Moves a LDAP entry from one DN to another DN.

This is an alias for rename()

Parameters:
string | Zend_Ldap_Dn$from
string | Zend_Ldap_Dn$to
boolean$recursively
boolean$alwaysEmulate
Returns:
Zend_Ldap Provides a fluid interface
Exceptions:
Zend_Ldap_Exception

Definition at line 1301 of file Ldap.php.

moveToSubtree ( from,
to,
recursively = false,
alwaysEmulate = false 
)

Moves a LDAP entry from one DN to another subtree.

Parameters:
string | Zend_Ldap_Dn$from
string | Zend_Ldap_Dn$to
boolean$recursively
boolean$alwaysEmulate
Returns:
Zend_Ldap Provides a fluid interface
Exceptions:
Zend_Ldap_Exception

Definition at line 1270 of file Ldap.php.

static prepareLdapEntryArray ( array &$  entry ) [static]

Prepares an ldap data entry array for insert/update operation

Parameters:
array$entry
Returns:
void
Exceptions:
InvalidArgumentException

Definition at line 1052 of file Ldap.php.

rename ( from,
to,
recursively = false,
alwaysEmulate = false 
)

Renames a LDAP entry from one DN to another DN.

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

Parameters:
string | Zend_Ldap_Dn$from
string | Zend_Ldap_Dn$to
boolean$recursively
boolean$alwaysEmulate
Returns:
Zend_Ldap Provides a fluid interface
Exceptions:
Zend_Ldap_Exception

See also:
Zend_Ldap_Exception

Definition at line 1318 of file Ldap.php.

save ( dn,
array $  entry 
)

Save entry to LDAP registry.

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

Parameters:
string | Zend_Ldap_Dn$dn
array$entry
Returns:
Zend_Ldap Provides a fluid interface
Exceptions:
Zend_Ldap_Exception

Definition at line 1185 of file Ldap.php.

search ( filter,
basedn = null,
scope = self::SEARCH_SCOPE_SUB,
array $  attributes = array(),
sort = null,
collectionClass = null 
)

A global LDAP search routine for finding information.

Parameters:
string | Zend_Ldap_Filter_Abstract$filter
string | Zend_Ldap_Dn | null$basedn
integer$scope
array$attributes
string | null$sort
string | null$collectionClass
Returns:
Zend_Ldap_Collection
Exceptions:
Zend_Ldap_Exception

See also:
Zend_Ldap_Exception
Zend_Ldap_Exception

Zend_Ldap_Collection_Iterator_Default

Zend_Ldap_Collection

See also:
Zend_Ldap_Exception
Zend_Ldap_Exception

Definition at line 884 of file Ldap.php.

searchEntries ( filter,
basedn = null,
scope = self::SEARCH_SCOPE_SUB,
array $  attributes = array(),
sort = null 
)

Search LDAP registry for entries matching filter and optional attributes

Parameters:
string | Zend_Ldap_Filter_Abstract$filter
string | Zend_Ldap_Dn | null$basedn
integer$scope
array$attributes
string | null$sort
Returns:
array
Exceptions:
Zend_Ldap_Exception

Definition at line 1017 of file Ldap.php.

setOptions ( options )

Sets the options used in connecting, binding, etc.

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

Parameters:
array | Zend_Config$optionsOptions used in connecting, binding, etc.
Returns:
Zend_Ldap Provides a fluent interface
Exceptions:
Zend_Ldap_Exception

See also:
Zend_Ldap_Exception

Definition at line 226 of file Ldap.php.

update ( dn,
array $  entry 
)

Update LDAP registry

Parameters:
string | Zend_Ldap_Dn$dn
array$entry
Returns:
Zend_Ldap Provides a fluid interface
Exceptions:
Zend_Ldap_Exception

See also:
Zend_Ldap_Exception

Definition at line 1144 of file Ldap.php.


The documentation for this class was generated from the following file: