Ldap/Node.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 license@zend.com 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  
Subpackage
Node  
Version
$Id$  

\Zend_Ldap_Node

Package: Zend_Ldap\Node
Zend_Ldap_Node provides an object oriented view into a LDAP node.
Implements
Parent(s)
\Zend_Ldap_Node_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotectedarray $_children
Holds an array of the current node's children.
Details
Type
array
>VPropertyprotectedboolean $_delete
This node will be deleted
Details
Type
boolean
>VPropertyprivateboolean $_iteratorRewind = false
Controls iteration status
Default valuefalseDetails
Type
boolean
>VPropertyprotected\Zend_Ldap $_ldap
Holds the connection to the LDAP server if in connected mode.
Details
Type
\Zend_Ldap
>VPropertyprotectedboolean $_new
This node will be added
Details
Type
boolean
>VPropertyprotected\Zend_Ldap_Dn $_newDn
Holds the node's new DN if node is renamed.
Details
Type
\Zend_Ldap_Dn
>VPropertyprotectedarray $_originalData
Holds the node's orginal attributes (as loaded).
Details
Type
array

Methods

methodprotected__construct(\Zend_Ldap_Dn $dn, array $data, boolean $fromDataSource, \Zend_Ldap $ldap = null) : void

Constructor.

Constructor is protected to enforce the use of factory methods.
Parameters
NameTypeDescription
$dn\Zend_Ldap_Dn
$dataarray
$fromDataSourceboolean
$ldap\Zend_Ldap
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublic__set(string $name, mixed $value) : null

Sets a LDAP attribute.

This is an offline method.
Parameters
NameTypeDescription
$namestring
$valuemixed
Returns
TypeDescription
null
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublic__sleep() : array

Serialization callback

Only DN and attributes will be serialized.
Returns
TypeDescription
array
methodpublic__unset(string $name) : null

Deletes a LDAP attribute.

This method deletes the attribute. This is an offline method.
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
null
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublic__wakeup() : null

Deserialization callback

Enforces a detached node.
Returns
TypeDescription
null
methodprotected_assertChangeableAttribute(string $name) : boolean

Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
boolean
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodprotected_ensureRdnAttributeValues(boolean $overwrite = false) : void

Ensures that teh RDN attributes are correctly set.

Parameters
NameTypeDescription
$overwriteboolean

True to overwrite the RDN attributes

methodprotected_getDn() : \Zend_Ldap_Dn

Gets the DN of the current node as a Zend_Ldap_Dn.

This is an offline method.
Returns
TypeDescription
\Zend_Ldap_Dn
methodprotected_loadData(array $data, boolean $fromDataSource) : void

Parameters
NameTypeDescription
$dataarray
$fromDataSourceboolean
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodprotected_markAsNew(boolean $new) : void

Marks this node as new.

Node will be added (instead of updated) on calling update() if $new is true.
Parameters
NameTypeDescription
$newboolean
methodprotected_markAsToBeDeleted(boolean $delete) : void

Marks this node as to be deleted.

Node will be deleted on calling update() if $delete is true.
Parameters
NameTypeDescription
$deleteboolean
methodprotected_postAdd() : void

Allows post-add logic to be applied to node.

Subclasses may override this method.
methodprotected_postDelete() : void

Allows post-delete logic to be applied to node.

Subclasses may override this method.
methodprotected_postRename() : void

Allows post-rename logic to be applied to node.

Subclasses may override this method.
methodprotected_postUpdate() : void

Allows post-update logic to be applied to node.

Subclasses may override this method.
methodprotected_preAdd() : void

Allows pre-add logic to be applied to node.

Subclasses may override this method.
methodprotected_preDelete() : void

Allows pre-delete logic to be applied to node.

Subclasses may override this method.
methodprotected_preRename() : void

Allows pre-rename logic to be applied to node.

Subclasses may override this method.
methodprotected_preUpdate() : void

Allows pre-update logic to be applied to node.

Subclasses may override this method.
methodprotected_setAttribute(string $name, mixed $value, boolean $append) : void

Checks if the attribute can be set and sets it accordingly.

Parameters
NameTypeDescription
$namestring
$valuemixed
$appendboolean
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodprotected_setDateTimeAttribute(string $name, integer | array $value, boolean $utc, boolean $append) : void

Checks if the attribute can be set and sets it accordingly.

Parameters
NameTypeDescription
$namestring
$valueinteger | array
$utcboolean
$appendboolean
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicappendObjectClass(array | string $value) : \Zend_Ldap_Node

Appends to the objectClass.

This is an offline method.
Parameters
NameTypeDescription
$valuearray | string
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicappendToAttribute(string $name, mixed $value) : \Zend_Ldap_Node

Appends to a LDAP attribute.

This is an offline method.
Parameters
NameTypeDescription
$namestring
$valuemixed
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicappendToDateTimeAttribute(string $name, integer | array $value, boolean $utc = false) : \Zend_Ldap_Node

Appends to a LDAP date/time attribute.

This is an offline method.
Parameters
NameTypeDescription
$namestring
$valueinteger | array
$utcboolean
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicattachLdap(\Zend_Ldap $ldap) : \Zend_Ldap_Node

Attach node to an LDAP connection

This is an offline method.
Parameters
NameTypeDescription
$ldap\Zend_Ldap
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
Throws
ExceptionDescription
\Zend_Ldap_Exception
Details
Uses
 
methodpubliccountChildren() : integer

Count children of current node.

This is an online method.
Returns
TypeDescription
integer
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpubliccountSubtree(string | \Zend_Ldap_Filter_Abstract $filter, integer $scope = \Zend_Ldap::SEARCH_SCOPE_SUB) : integer

Count items in current subtree found by given filter.

This is an online method.
Parameters
NameTypeDescription
$filterstring | \Zend_Ldap_Filter_Abstract
$scopeinteger
Returns
TypeDescription
integer
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpubliccreate(string | array | \Zend_Ldap_Dn $dn, array $objectClass = array()) : \Zend_Ldap_Node
static

Factory method to create a new detached Zend_Ldap_Node for a given DN.

Parameters
NameTypeDescription
$dnstring | array | \Zend_Ldap_Dn
$objectClassarray
Returns
TypeDescription
\Zend_Ldap_Node
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpubliccurrent() : array

Return the current attribute.

Implements Iterator
Returns
TypeDescription
array
methodpublicdelete() : \Zend_Ldap_Node

Marks this node as to be deleted

Node will be deleted on calling update() if $delete is true.
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
methodpublicdeleteAttribute(string $name) : \Zend_Ldap_Node

Deletes a LDAP attribute.

This method deletes the attribute. This is an offline method.
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicdetachLdap() : \Zend_Ldap_Node

Detach node from LDAP connection

This is an offline method.
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
methodpublicexists(\Zend_Ldap $ldap = null) : boolean

Check if node exists on LDAP.

This is an online method.
Parameters
NameTypeDescription
$ldap\Zend_Ldap
Returns
TypeDescription
boolean
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicfromArray(array $data, boolean $fromDataSource = false) : \Zend_Ldap_Node
static

Factory method to create a detached Zend_Ldap_Node from array data.

Parameters
NameTypeDescription
$dataarray
$fromDataSourceboolean
Returns
TypeDescription
\Zend_Ldap_Node
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicfromLdap(string | array | \Zend_Ldap_Dn $dn, \Zend_Ldap $ldap) : \Zend_Ldap_Node | null
static

Factory method to create an attached Zend_Ldap_Node for a given DN.

Parameters
NameTypeDescription
$dnstring | array | \Zend_Ldap_Dn
$ldap\Zend_Ldap
Returns
TypeDescription
\Zend_Ldap_Node | null
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicgetChangedData() : array

Gets changed node data.

The array contains all changed attributes. This format can be used in {@link Zend_Ldap::add()} and {@link Zend_Ldap::update()}. This is an offline method.
Returns
TypeDescription
array
methodpublicgetChanges() : array

Returns all changes made.

This is an offline method.
Returns
TypeDescription
array
methodpublicgetChildren() : \Zend_Ldap_Node_ChildrenIterator

Returns the children for the current node.

Can be used offline but returns an empty array if children have not been retrieved yet.
Returns
TypeDescription
\Zend_Ldap_Node_ChildrenIterator
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicgetCurrentDn() : \Zend_Ldap_Dn

Gets the current DN of the current node as a Zend_Ldap_Dn.

The method returns a clone of the node's DN to prohibit modification. This is an offline method.
Returns
TypeDescription
\Zend_Ldap_Dn
methodpublicgetLdap() : \Zend_Ldap

Gets the current LDAP connection.

Returns
TypeDescription
\Zend_Ldap
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicgetParent(\Zend_Ldap $ldap = null) : \Zend_Ldap_Node

Returns the parent of the current node.

Parameters
NameTypeDescription
$ldap\Zend_Ldap
Returns
TypeDescription
\Zend_Ldap_Node
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublichasChildren() : boolean

Checks if current node has children.

Returns whether the current element has children. Can be used offline but returns false if children have not been retrieved yet.
Returns
TypeDescription
boolean
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicisAttached() : boolean

Checks if the current node is attached to a LDAP server.

This is an offline method.
Returns
TypeDescription
boolean
methodpublicisNew() : boolean

Tells if the node is consiedered as new (not present on the server)

Please note, that this doesn't tell you if the node is present on the server. Use {@link exits()} to see if a node is already there.
Returns
TypeDescription
boolean
methodpublickey() : string

Return the attribute name.

Implements Iterator
Returns
TypeDescription
string
methodpublicmove(\Zend_Ldap_Dn | string | array $newDn) : \Zend_Ldap_Node

{@see setDn()}

This is an offline method.
Parameters
NameTypeDescription
$newDn\Zend_Ldap_Dn | string | array
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicnext() : void

Move forward to next attribute.

Implements Iterator
methodpublicoffsetSet(string $name, mixed $value) : null

Sets a LDAP attribute.

Implements ArrayAccess. This is an offline method.
Parameters
NameTypeDescription
$namestring
$valuemixed
Returns
TypeDescription
null
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicoffsetUnset(string $name) : null

Deletes a LDAP attribute.

Implements ArrayAccess. This method deletes the attribute. This is an offline method.
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
null
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicreload(\Zend_Ldap $ldap = null) : \Zend_Ldap_Node

Reload node attributes from LDAP.

This is an online method.
Parameters
NameTypeDescription
$ldap\Zend_Ldap
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicremoveDuplicatesFromAttribute(string $attribName) : void

Removes duplicate values from a LDAP attribute

Parameters
NameTypeDescription
$attribNamestring
methodpublicremoveFromAttribute(string $attribName, mixed | array $value) : void

Remove given values from a LDAP attribute

Parameters
NameTypeDescription
$attribNamestring
$valuemixed | array
methodpublicrename(\Zend_Ldap_Dn | string | array $newDn) : \Zend_Ldap_Node

{@see setDn()}

This is an offline method.
Parameters
NameTypeDescription
$newDn\Zend_Ldap_Dn | string | array
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicrewind() : void

Rewind the Iterator to the first attribute.

Implements Iterator
methodpublicsearchChildren(string | \Zend_Ldap_Filter_Abstract $filter, string $sort = null) : \Zend_Ldap_Node_Collection

Gets children of current node.

This is an online method.
Parameters
NameTypeDescription
$filterstring | \Zend_Ldap_Filter_Abstract
$sortstring
Returns
TypeDescription
\Zend_Ldap_Node_Collection
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicsearchSubtree(string | \Zend_Ldap_Filter_Abstract $filter, integer $scope = \Zend_Ldap::SEARCH_SCOPE_SUB, string $sort = null) : \Zend_Ldap_Node_Collection

Search current subtree with given options.

This is an online method.
Parameters
NameTypeDescription
$filterstring | \Zend_Ldap_Filter_Abstract
$scopeinteger
$sortstring
Returns
TypeDescription
\Zend_Ldap_Node_Collection
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicsetAttribute(string $name, mixed $value) : \Zend_Ldap_Node

Sets a LDAP attribute.

This is an offline method.
Parameters
NameTypeDescription
$namestring
$valuemixed
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicsetDateTimeAttribute(string $name, integer | array $value, boolean $utc = false) : \Zend_Ldap_Node

Sets a LDAP date/time attribute.

This is an offline method.
Parameters
NameTypeDescription
$namestring
$valueinteger | array
$utcboolean
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicsetDn(\Zend_Ldap_Dn | string | array $newDn) : \Zend_Ldap_Node

Sets the new DN for this node

This is an offline method.
Parameters
NameTypeDescription
$newDn\Zend_Ldap_Dn | string | array
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicsetObjectClass(array | string $value) : \Zend_Ldap_Node

Sets the objectClass.

This is an offline method.
Parameters
NameTypeDescription
$valuearray | string
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicsetPasswordAttribute(string $password, string $hashType = \Zend_Ldap_Attribute::PASSWORD_HASH_MD5, string $attribName = 'userPassword') : \Zend_Ldap_Node

Sets a LDAP password.

Parameters
NameTypeDescription
$passwordstring
$hashTypestring
$attribNamestring
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublictoLdif(array $options = array()) : string

Returns a LDIF representation of the current node

Parameters
NameTypeDescription
$optionsarray

Additional options used during encoding

Returns
TypeDescription
string
methodpublicupdate(\Zend_Ldap $ldap = null) : \Zend_Ldap_Node

Sends all pending changes to the LDAP server

Parameters
NameTypeDescription
$ldap\Zend_Ldap
Returns
TypeDescription
\Zend_Ldap_NodeProvides a fluid interface
Throws
ExceptionDescription
\Zend_Ldap_Exception
methodpublicvalid() : boolean

Check if there is a current attribute after calls to rewind() or next().

Implements Iterator
Returns
TypeDescription
boolean
methodpublicwillBeDeleted() : boolean

Is this node going to be deleted once update() is called?

Returns
TypeDescription
boolean
methodpublicwillBeMoved() : boolean

Is this node going to be moved once update() is called?

Returns
TypeDescription
boolean
Documentation was generated by phpDocumentor 2.2.0 .