category |
Zend |
package |
Zend_Ldap |
copyright |
Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license |
New BSD License |
Methods
Constructor.
__construct(array|\Zend_Config $options = array()
) : void
Parameters
$options
array
\Zend_Config
Options used in connecting, binding, etc.
Exceptions
\Zend_Ldap_Exception |
if ext/ldap is not installed |
Destructor.
__destruct() : void
Add new information to the LDAP repository
add(string|\Zend_Ldap_Dn $dn, array $entry) : \Zend_Ldap
Parameters
$dn
string
\Zend_Ldap_Dn
$entry
array
Exceptions
Returns
\Zend_Ldap
Provides a fluent interface
bind()
bind(string $username = null
, string $password = null
) : \Zend_Ldap
Parameters
$username
string
The username for authenticating the bind
$password
string
The password for authenticating the bind
Exceptions
Returns
\Zend_Ldap
Provides 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
) : \Zend_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
$useStartTls
boolean
Use STARTTLS
Exceptions
Returns
\Zend_Ldap
Provides 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
Parameters
$from
string
\Zend_Ldap_Dn
$to
string
\Zend_Ldap_Dn
$recursively
boolean
Exceptions
Returns
\Zend_Ldap
Provides a fluent 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
Parameters
$from
string
\Zend_Ldap_Dn
$to
string
\Zend_Ldap_Dn
$recursively
boolean
Exceptions
Returns
\Zend_Ldap
Provides a fluent interface
Count items found by given filter.
count(string|\Zend_Ldap_Filter_Abstract $filter, string|\Zend_Ldap_Dn|null $basedn = null
, integer $scope = self::SEARCH_SCOPE_SUB
) : integer
Parameters
$filter
string
\Zend_Ldap_Filter_Abstract
$basedn
string
\Zend_Ldap_Dn
null
$scope
integer
Exceptions
Returns
integer
Count children for a given DN.
countChildren(string|\Zend_Ldap_Dn $dn) : integer
Parameters
$dn
string
\Zend_Ldap_Dn
Exceptions
Returns
integer
Delete an LDAP entry
delete(string|\Zend_Ldap_Dn $dn, boolean $recursively = false
) : \Zend_Ldap
Parameters
$dn
string
\Zend_Ldap_Dn
$recursively
boolean
Exceptions
Returns
\Zend_Ldap
Provides a fluent interface
disconnect()
disconnect() : \Zend_Ldap
Returns
\Zend_Ldap
Provides a fluent interface
Check if a given DN exists.
exists(string|\Zend_Ldap_Dn $dn) : boolean
Parameters
$dn
string
\Zend_Ldap_Dn
Exceptions
Returns
boolean
explodeDn()
explodeDn(string $dn, array $keys = null
, array $vals = null
) : boolean
Static
deprecated |
will be removed, use {@see Zend_Ldap_Dn::checkDn()} |
Parameters
$dn
string
The DN to parse
$keys
array
An optional array to receive DN keys (e.g. CN, OU, DC, ...)
$vals
array
An 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.
filterEscape()
filterEscape(string $str) : string
Static
deprecated |
will be removed, use {@see Zend_Ldap_Filter_Abstract::escapeValue()} |
Parameters
$str
string
The string to escape.
Returns
string
The escaped string
Gets the base DN under which objects of interest are located
getBaseDn() : string
Returns the base node as a Zend_Ldap_Node
getBaseNode() : \Zend_Ldap_Node
Exceptions
Returns
\Zend_Ldap_Node
Get the currently bound user
getBoundUser() : false | 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
false
null
string
getCanonicalAccountName()
getCanonicalAccountName(string $acctname, $form = 0
) : string
Parameters
$acctname
string
The name to canonicalize
$form
Exceptions
Returns
string
The 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
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 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
Returns
\Zend_Ldap_Node
null
getOptions()
getOptions() : array
Returns
array
The current options.
getResource()
getResource() : resource
Returns
resource
The raw LDAP extension resource.
Returns the RootDSE
getRootDse() : \Zend_Ldap_Node_RootDse
Exceptions
Returns
\Zend_Ldap_Node_RootDse
Returns the schema
getSchema() : \Zend_Ldap_Node_Schema
Exceptions
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
This is an alias for \rename()
Parameters
$from
string
\Zend_Ldap_Dn
$to
string
\Zend_Ldap_Dn
$recursively
boolean
$alwaysEmulate
boolean
Exceptions
Returns
\Zend_Ldap
Provides a fluent 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
Parameters
$from
string
\Zend_Ldap_Dn
$to
string
\Zend_Ldap_Dn
$recursively
boolean
$alwaysEmulate
boolean
Exceptions
Returns
\Zend_Ldap
Provides a fluent interface
Prepares an ldap data entry array for insert/update operation
prepareLdapEntryArray(array $entry) : void
Static
Parameters
$entry
array
Exceptions
\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
This method implicitely 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
Returns
\Zend_Ldap
Provides a fluent interface
Save entry to LDAP registry.
save(string|\Zend_Ldap_Dn $dn, array $entry) : \Zend_Ldap
Internally decides if entry will be updated to added by calling
\exists().
Parameters
$dn
string
\Zend_Ldap_Dn
$entry
array
Exceptions
Returns
\Zend_Ldap
Provides a fluent interface
A global LDAP search routine for finding information.
search(string|\Zend_Ldap_Filter_Abstract|array $filter, string|\Zend_Ldap_Dn|null $basedn = null
, integer $scope = self::SEARCH_SCOPE_SUB
, array $attributes = array()
, string|null $sort = null
, string|null $collectionClass = null
, integer $sizelimit = 0
, integer $timelimit = 0
) : \Zend_Ldap_Collection
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
- collectionClass
- sizelimit
- timelimit
Parameters
$filter
string
\Zend_Ldap_Filter_Abstract
array
$basedn
string
\Zend_Ldap_Dn
null
$scope
integer
$attributes
array
$sort
string
null
$collectionClass
string
null
$sizelimit
integer
$timelimit
integer
Exceptions
Returns
\Zend_Ldap_Collection
Search LDAP registry for entries matching filter and optional attributes
searchEntries(string|\Zend_Ldap_Filter_Abstract|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_Abstract
array
$basedn
string
\Zend_Ldap_Dn
null
$scope
integer
$attributes
array
$sort
string
null
$reverseSort
boolean
$sizelimit
integer
$timelimit
integer
Exceptions
Returns
array
Sets the options used in connecting, binding, etc.
setOptions(array|\Zend_Config $options) : \Zend_Ldap
Valid option keys:
host
port
useSsl
username
password
bindRequiresDn
baseDn
accountCanonicalForm
accountDomainName
accountDomainNameShort
accountFilterFormat
allowEmptyPassword
useStartTls
optRefferals
tryUsernameSplit
Parameters
$options
array
\Zend_Config
Options used in connecting, binding, etc.
Exceptions
Returns
\Zend_Ldap
Provides a fluent interface
Update LDAP registry
update(string|\Zend_Ldap_Dn $dn, array $entry) : \Zend_Ldap
Parameters
$dn
string
\Zend_Ldap_Dn
$entry
array
Exceptions
Returns
\Zend_Ldap
Provides a fluent interface
Extension point for collection creation
_createCollection(\Zend_Ldap_Collection_Iterator_Default $iterator, string|null $collectionClass) : \Zend_Ldap_Collection
Parameters
$iterator
\Zend_Ldap_Collection_Iterator_Default
$collectionClass
string
null
Exceptions
Returns
\Zend_Ldap_Collection
_getAccount()
_getAccount($acctname, array $attrs = null
) : array
Parameters
$acctname
$attrs
array
An array of names of desired attributes
Exceptions
Returns
array
An array of the attributes representing the account
_getAccountDn()
_getAccountDn(string $acctname) : string
Parameters
$acctname
string
The name of the account
Exceptions
Returns
string
The DN of the specified account
_getAccountDomainName()
_getAccountDomainName() : string
Returns
string
The account domain name
_getAccountDomainNameShort()
_getAccountDomainNameShort() : string
Returns
string
The short account domain name
_getAccountFilter()
_getAccountFilter($acctname) : string
Parameters
$acctname
Returns
string
The LDAP search filter for matching directory accounts
_getAllowEmptyPassword()
_getAllowEmptyPassword() : boolean
Returns
boolean
Allow empty passwords
_getBindRequiresDn()
_getBindRequiresDn() : boolean
Returns
boolean
Bind 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
Returns
array
of DNs
_getHost()
_getHost() : string
Returns
string
The hostname of the LDAP server being used to authenticate accounts
_getOptReferrals()
_getOptReferrals() : boolean
Returns
boolean
Opt. Referrals
_getPassword()
_getPassword() : string
Returns
string
The default password for binding
_getPort()
_getPort() : integer
Returns
integer
The port of the LDAP server or 0 to indicate that no port value is set
_getTryUsernameSplit()
_getTryUsernameSplit() : boolean
Returns
boolean
Try splitting the username into username and domain
_getUseSsl()
_getUseSsl() : boolean
Returns
boolean
The default SSL / TLS encrypted transport control
_getUseStartTls()
_getUseStartTls() : boolean
Returns
boolean
The default SSL / TLS encrypted transport control
_getUsername()
_getUsername() : string
Returns
string
The 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
The options used in connecting, binding, etc.
$_options : array
The raw LDAP extension resource.
$_resource : resource
Caches the RootDSE
$_rootDse : \Zend_Ldap_Node
Caches the schema
$_schema : \Zend_Ldap_Node
String used with ldap_connect for error handling purposes.
$_connectString : string
Constants
SEARCH_SCOPE_BASE
SEARCH_SCOPE_BASE = 3
SEARCH_SCOPE_ONE
SEARCH_SCOPE_ONE = 2
SEARCH_SCOPE_SUB
SEARCH_SCOPE_SUB = 1