Ldap/Dn.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
-
New BSD License
- Package
- Zend_Ldap
- Version
- $Id: Dn.php 24593 2012-01-05 20:35:02Z matthew $
Package: Zend\LdapZend_Ldap_Dn provides an API for DN manipulation
- Implements
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
-
New BSD License
Constants


ATTR_CASEFOLD_NONE
= 'none'


ATTR_CASEFOLD_UPPER
= 'upper'


ATTR_CASEFOLD_LOWER
= 'lower'
Properties



string $_defaultCaseFold = self::ATTR_CASEFOLD_NONE
staticThe default case fold to use
Default valueself::ATTR_CASEFOLD_NONE
Details
- Type
- string
Methods



_assertIndex(mixed $index) : boolean
Assert index is correct and usable
Parameters
Name |
Type |
Description |
$index |
mixed |
|
Returns
Throws



_assertRdn(array $value) : boolean
staticAssert if value is in a correct RDN format
Parameters
Name |
Type |
Description |
$value |
array |
|
Returns
Throws



_caseFoldDn(array $dn, string $caseFold) : array
staticDo a case folding on a DN ort part of it
Parameters
Name |
Type |
Description |
$dn |
array |
|
$caseFold |
string |
|
Returns



_caseFoldRdn(array $part, string $caseFold) : array
staticDo a case folding on a RDN
Parameters
Name |
Type |
Description |
$part |
array |
|
$caseFold |
string |
|
Returns



_sanitizeCaseFold(string $caseFold, $default) : string
staticSanitizes the case fold
Parameters
Name |
Type |
Description |
$caseFold |
string |
|
$default |
|
|
Returns



checkDn(string $dn, array $keys = null, array $vals = null, string $caseFold = self::ATTR_CASEFOLD_NONE) : boolean
Parameters
Name |
Type |
Description |
$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 |
$caseFold |
string |
|
Returns
Type |
Description |
boolean |
True if the DN was successfully parsed or false if the string is not a valid DN. |



escapeValue(string | array $values = array()) : array
staticEscapes a DN value according to RFC 2253
Escapes the given VALUES according to RFC 2253 so that they can be safely used in LDAP DNs.
The characters ",", "+", """, "\", "<", ">", ";", "#", " = " with a special meaning in RFC 2252
are preceeded by ba backslash. Control characters with an ASCII code < 32 are represented as \hexpair.
Finally all leading and trailing spaces are converted to sequences of \20.
Parameters
Name |
Type |
Description |
$values |
string | array |
An array containing the DN values that should be escaped |
Returns
Type |
Description |
array |
The array $values, but escaped |
Details
- Author
-
Benedikt Hallinger
- Link
-
http://pear.php.net/package/Net_LDAP2
- See
- \global\Net_LDAP2_Util::escape_dn_value()



explodeDn(string $dn, array $keys = null, array $vals = null, string $caseFold = self::ATTR_CASEFOLD_NONE) : array
staticCreates an array containing all parts of the given DN.
Array will be of type
array(
array("cn" => "name1", "uid" => "user"),
array("cn" => "name2"),
array("dc" => "example"),
array("dc" => "org")
)
for a DN of cn=name1+uid=user,cn=name2,dc=example,dc=org.
Parameters
Name |
Type |
Description |
$dn |
string |
|
$keys |
array |
An optional array to receive DN keys (e.g. CN, OU, DC, ...)
|
$vals |
array |
An optional array to receive DN values |
$caseFold |
string |
|
Returns
Throws



factory(string | array $dn, string | null $caseFold = null) : \Zend_Ldap_Dn
staticCreates a DN from an array or a string
Parameters
Name |
Type |
Description |
$dn |
string | array |
|
$caseFold |
string | null |
|
Returns
Throws



fromArray(array $dn, string | null $caseFold = null) : \Zend_Ldap_Dn
staticCreates a DN from an array
Parameters
Name |
Type |
Description |
$dn |
array |
|
$caseFold |
string | null |
|
Returns
Throws



fromString(string $dn, string | null $caseFold = null) : \Zend_Ldap_Dn
staticCreates a DN from a string
Parameters
Name |
Type |
Description |
$dn |
string |
|
$caseFold |
string | null |
|
Returns
Throws



getParentDn(int $levelUp = 1) : \Zend_Ldap_Dn
Get the parent DN $levelUp levels up the tree
Parameters
Name |
Type |
Description |
$levelUp |
int |
|
Returns



getRdn(string $caseFold = null) : array
Gets the RDN of the current DN
Parameters
Name |
Type |
Description |
$caseFold |
string |
|
Returns
Throws



getRdnString(string $caseFold = null) : string
Gets the RDN of the current DN as a string
Parameters
Name |
Type |
Description |
$caseFold |
string |
|
Returns
Throws



implodeDn(array $dnArray, string $caseFold = null, string $separator = ',') : string
staticImplodes an array in the form delivered by {@link explodeDn()}
to a DN string.
$dnArray must be of type
array(
array("cn" => "name1", "uid" => "user"),
array("cn" => "name2"),
array("dc" => "example"),
array("dc" => "org")
)
Parameters
Name |
Type |
Description |
$dnArray |
array |
|
$caseFold |
string |
|
$separator |
string |
|
Returns
Throws



implodeRdn( $part, string $caseFold = null) : string
staticReturns a DN part in the form $attribute = $value
This method supports the creation of multi-valued RDNs
$part must contain an even number of elemets.
Parameters
Name |
Type |
Description |
$part |
|
|
$caseFold |
string |
|
Returns
Throws



offsetExists(int $offset) : boolean
Required by the ArrayAccess implementation
Parameters
Name |
Type |
Description |
$offset |
int |
|
Returns



offsetGet(int $offset) : array
Proxy to {@see get()}
Required by the ArrayAccess implementation
Parameters
Name |
Type |
Description |
$offset |
int |
|
Returns



offsetSet(int $offset, array $value) : void
Proxy to {@see set()}
Required by the ArrayAccess implementation
Parameters
Name |
Type |
Description |
$offset |
int |
|
$value |
array |
|



offsetUnset(int $offset) : void
Proxy to {@see remove()}
Required by the ArrayAccess implementation
Parameters
Name |
Type |
Description |
$offset |
int |
|



setDefaultCaseFold(string $caseFold) : void
staticSets the default case fold
Parameters
Name |
Type |
Description |
$caseFold |
string |
|



unescapeValue(string | array $values = array()) : array
staticUndoes the conversion done by {@link escapeValue()}.
Any escape sequence starting with a baskslash - hexpair or special character -
will be transformed back to the corresponding character.
Parameters
Name |
Type |
Description |
$values |
string | array |
Array of DN Values |
Returns
Type |
Description |
array |
Same as $values, but unescaped |
Details
- Author
-
Benedikt Hallinger
- Link
-
http://pear.php.net/package/Net_LDAP2
- See
- \global\Net_LDAP2_Util::escape_dn_value()