Ldap/Dn.php

Show: PublicProtectedPrivateinherited
Table of Contents
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-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Ldap  
Version
$Id$  

\Zend_Ldap_Dn

Package: Zend_Ldap
Zend_Ldap_Dn provides an API for DN manipulation
Implements
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

>VConstant  ATTR_CASEFOLD_NONE = 'none'
>VConstant  ATTR_CASEFOLD_UPPER = 'upper'
>VConstant  ATTR_CASEFOLD_LOWER = 'lower'

Properties

>VPropertyprotectedstring $_caseFold
The case fold used for this instance
Details
Type
string
>VPropertyprotectedstring $_defaultCaseFold = self::ATTR_CASEFOLD_NONE
static
The default case fold to use
Default valueself::ATTR_CASEFOLD_NONEDetails
Type
string
>VPropertyprotectedarray $_dn
The DN data
Details
Type
array

Methods

methodprotected__construct(array $dn, string | null $caseFold) : void

Constructor

Parameters
NameTypeDescription
$dnarray
$caseFoldstring | null
methodpublic__toString() : string

Cast to string representation {@see toString()}

Returns
TypeDescription
string
methodprotected_assertIndex(mixed $index) : boolean

Assert index is correct and usable

Parameters
NameTypeDescription
$indexmixed
Returns
TypeDescription
boolean
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodprotected_assertRdn(array $value) : boolean
static

Assert if value is in a correct RDN format

Parameters
NameTypeDescription
$valuearray
Returns
TypeDescription
boolean
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodprotected_caseFoldDn(array $dn, string $caseFold) : array
static

Do a case folding on a DN ort part of it

Parameters
NameTypeDescription
$dnarray
$caseFoldstring
Returns
TypeDescription
array
methodprotected_caseFoldRdn(array $part, string $caseFold) : array
static

Do a case folding on a RDN

Parameters
NameTypeDescription
$partarray
$caseFoldstring
Returns
TypeDescription
array
methodprotected_sanitizeCaseFold(string $caseFold,  $default) : string
static

Sanitizes the case fold

Parameters
NameTypeDescription
$caseFoldstring
$default
Returns
TypeDescription
string
methodpublicappend(array $value) : \Zend_Ldap_Dn

Append a DN part

Parameters
NameTypeDescription
$valuearray
Returns
TypeDescription
\Zend_Ldap_DnProvides a fluent interface
methodpubliccheckDn(string $dn, array $keys = null, array $vals = null, string $caseFold = self::ATTR_CASEFOLD_NONE) : boolean
static

Parameters
NameTypeDescription
$dnstring

The DN to parse

$keysarray

An optional array to receive DN keys (e.g. CN, OU, DC, ...)

$valsarray

An optional array to receive DN values

$caseFoldstring
Returns
TypeDescription
booleanTrue if the DN was successfully parsed or false if the string is not a valid DN.
methodpublicescapeValue(string | array $values = array()) : array
static

Escapes 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
NameTypeDescription
$valuesstring | array

An array containing the DN values that should be escaped

Returns
TypeDescription
arrayThe array $values, but escaped
Details
Author
Benedikt Hallinger  
Link
http://pear.php.net/package/Net_LDAP2  
See
from Benedikt Hallinger  
methodpublicexplodeDn(string $dn, array $keys = null, array $vals = null, string $caseFold = self::ATTR_CASEFOLD_NONE) : array
static

Creates 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
NameTypeDescription
$dnstring
$keysarray

An optional array to receive DN keys (e.g. CN, OU, DC, ...)

$valsarray

An optional array to receive DN values

$caseFoldstring
Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicfactory(string | array $dn, string | null $caseFold = null) : \Zend_Ldap_Dn
static

Creates a DN from an array or a string

Parameters
NameTypeDescription
$dnstring | array
$caseFoldstring | null
Returns
TypeDescription
\Zend_Ldap_Dn
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicfromArray(array $dn, string | null $caseFold = null) : \Zend_Ldap_Dn
static

Creates a DN from an array

Parameters
NameTypeDescription
$dnarray
$caseFoldstring | null
Returns
TypeDescription
\Zend_Ldap_Dn
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicfromString(string $dn, string | null $caseFold = null) : \Zend_Ldap_Dn
static

Creates a DN from a string

Parameters
NameTypeDescription
$dnstring
$caseFoldstring | null
Returns
TypeDescription
\Zend_Ldap_Dn
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicget(int $index, int $length = 1, string $caseFold = null) : array

Get a DN part

Parameters
NameTypeDescription
$indexint
$lengthint
$caseFoldstring
Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Ldap_Exceptionif index is illegal
methodpublicgetParentDn(int $levelUp = 1) : \Zend_Ldap_Dn

Get the parent DN $levelUp levels up the tree

Parameters
NameTypeDescription
$levelUpint
Returns
TypeDescription
\Zend_Ldap_Dn
methodpublicgetRdn(string $caseFold = null) : array

Gets the RDN of the current DN

Parameters
NameTypeDescription
$caseFoldstring
Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_Ldap_Exceptionif DN has no RDN (empty array)
methodpublicgetRdnString(string $caseFold = null) : string

Gets the RDN of the current DN as a string

Parameters
NameTypeDescription
$caseFoldstring
Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Ldap_Exceptionif DN has no RDN (empty array)
methodpublicimplodeDn(array $dnArray, string $caseFold = null, string $separator = ',') : string
static

Implodes 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
NameTypeDescription
$dnArrayarray
$caseFoldstring
$separatorstring
Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicimplodeRdn( $part, string $caseFold = null) : string
static

Returns 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
NameTypeDescription
$part
$caseFoldstring
Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicinsert(int $index, array $value) : \Zend_Ldap_Dn

Insert a DN part

Parameters
NameTypeDescription
$indexint
$valuearray
Returns
TypeDescription
\Zend_Ldap_DnProvides a fluent interface
Throws
ExceptionDescription
\Zend_Ldap_Exceptionif index is illegal
methodpublicisChildOf(string | \Zend_Ldap_Dn $childDn, string | \Zend_Ldap_Dn $parentDn) : boolean
static

Checks if given $childDn is beneath $parentDn subtree.

Parameters
NameTypeDescription
$childDnstring | \Zend_Ldap_Dn
$parentDnstring | \Zend_Ldap_Dn
Returns
TypeDescription
boolean
methodpublicoffsetExists(int $offset) : boolean

Required by the ArrayAccess implementation

Parameters
NameTypeDescription
$offsetint
Returns
TypeDescription
boolean
methodpublicoffsetGet(int $offset) : array

Proxy to {@see get()} Required by the ArrayAccess implementation

Parameters
NameTypeDescription
$offsetint
Returns
TypeDescription
array
methodpublicoffsetSet(int $offset, array $value) : void

Proxy to {@see set()} Required by the ArrayAccess implementation

Parameters
NameTypeDescription
$offsetint
$valuearray
methodpublicoffsetUnset(int $offset) : void

Proxy to {@see remove()} Required by the ArrayAccess implementation

Parameters
NameTypeDescription
$offsetint
methodpublicprepend(array $value) : \Zend_Ldap_Dn

Prepend a DN part

Parameters
NameTypeDescription
$valuearray
Returns
TypeDescription
\Zend_Ldap_DnProvides a fluent interface
methodpublicremove(int $index, int $length = 1) : \Zend_Ldap_Dn

Remove a DN part

Parameters
NameTypeDescription
$indexint
$lengthint
Returns
TypeDescription
\Zend_Ldap_DnProvides a fluent interface
Throws
ExceptionDescription
\Zend_Ldap_Exceptionif index is illegal
methodpublicset(int $index, array $value) : \Zend_Ldap_Dn

Set a DN part

Parameters
NameTypeDescription
$indexint
$valuearray
Returns
TypeDescription
\Zend_Ldap_DnProvides a fluent interface
Throws
ExceptionDescription
\Zend_Ldap_Exceptionif index is illegal
methodpublicsetCaseFold(string | null $caseFold) : void

Sets the case fold

Parameters
NameTypeDescription
$caseFoldstring | null
methodpublicsetDefaultCaseFold(string $caseFold) : void
static

Sets the default case fold

Parameters
NameTypeDescription
$caseFoldstring
methodpublictoArray(string $caseFold = null) : array

Return DN as an array

Parameters
NameTypeDescription
$caseFoldstring
Returns
TypeDescription
array
methodpublictoString(string $caseFold = null) : string

Return DN as a string

Parameters
NameTypeDescription
$caseFoldstring
Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicunescapeValue(string | array $values = array()) : array
static

Undoes 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
NameTypeDescription
$valuesstring | array

Array of DN Values

Returns
TypeDescription
arraySame as $values, but unescaped
Details
Author
Benedikt Hallinger  
Link
http://pear.php.net/package/Net_LDAP2  
See
from Benedikt Hallinger  
Documentation was generated by phpDocumentor 2.2.0 .