API Documentation

Zend/Ldap/Node.php

Show: inherited
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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Ldap  
Subpackage
Node  
Version
$Id: Node.php 24615 2012-01-23 15:49:10Z sgehrig $  

\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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

Propertyprotectedarray  $_children= ''

Holds an array of the current node's children.

Details
Type
array
Propertyprotectedboolean  $_delete= ''

This node will be deleted

Details
Type
boolean
Propertyprivateboolean  $_iteratorRewind= 'false'

Controls iteration status

Default valuefalseDetails
Type
boolean
Propertyprotected\Zend_Ldap  $_ldap= ''

Holds the connection to the LDAP server if in connected mode.

Details
Type
\Zend_Ldap
Propertyprotectedboolean  $_new= ''

This node will be added

Details
Type
boolean
Propertyprotected\Zend_Ldap_Dn  $_newDn= ''

Holds the node's new DN if node is renamed.

Details
Type
\Zend_Ldap_Dn
Propertyprotectedarray  $_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
Name Type Description
$dn \Zend_Ldap_Dn
$data array
$fromDataSource boolean
$ldap \Zend_Ldap
Throws
Exception Description
\Zend_Ldap_Exception
methodpublic__set( string $name, mixed $value ) : null

Sets a LDAP attribute.

This is an offline method.

Parameters
Name Type Description
$name string
$value mixed
Returns
Type Description
null
Throws
Exception Description
\Zend_Ldap_Exception
methodpublic__sleep( ) : array

Serialization callback

Only DN and attributes will be serialized.

Returns
Type Description
array
methodpublic__unset( string $name ) : null

Deletes a LDAP attribute.

This method deletes the attribute.

This is an offline method.

Parameters
Name Type Description
$name string
Returns
Type Description
null
Throws
Exception Description
\Zend_Ldap_Exception
methodpublic__wakeup( ) : null

Deserialization callback

Enforces a detached node.

Returns
Type Description
null
methodprotected_assertChangeableAttribute( string $name ) : boolean

Parameters
Name Type Description
$name string
Returns
Type Description
boolean
Throws
Exception Description
\Zend_Ldap_Exception
methodprotected_ensureRdnAttributeValues( boolean $overwrite = false ) : void

Ensures that teh RDN attributes are correctly set.

Parameters
Name Type Description
$overwrite boolean

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
Type Description
\Zend_Ldap_Dn
methodprotected_loadData( array $data, boolean $fromDataSource ) : void

Parameters
Name Type Description
$data array
$fromDataSource boolean
Throws
Exception Description
\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
Name Type Description
$new boolean
methodprotected_markAsToBeDeleted( boolean $delete ) : void

Marks this node as to be deleted.

Node will be deleted on calling update() if $delete is true.

Parameters
Name Type Description
$delete boolean
methodprotected_setAttribute( string $name, mixed $value, boolean $append ) : void

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

Parameters
Name Type Description
$name string
$value mixed
$append boolean
Throws
Exception Description
\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
Name Type Description
$name string
$value integer|array
$utc boolean
$append boolean
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicappendObjectClass( array|string $value ) : \Zend_Ldap_Node

Appends to the objectClass.

This is an offline method.

Parameters
Name Type Description
$value array|string
Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicappendToAttribute( string $name, mixed $value ) : \Zend_Ldap_Node

Appends to a LDAP attribute.

This is an offline method.

Parameters
Name Type Description
$name string
$value mixed
Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
Throws
Exception Description
\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
Name Type Description
$name string
$value integer|array
$utc boolean
Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicattachLdap( \Zend_Ldap $ldap ) : \Zend_Ldap_Node

Attach node to an LDAP connection

This is an offline method.

Parameters
Name Type Description
$ldap \Zend_Ldap
Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
Throws
Exception Description
\Zend_Ldap_Exception
Details
Uses
\Zend_Ldap_Dn::isChildOf()  
methodpubliccountChildren( ) : integer

Count children of current node.

This is an online method.

Returns
Type Description
integer
Throws
Exception Description
\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
Name Type Description
$filter string|\Zend_Ldap_Filter_Abstract
$scope integer
Returns
Type Description
integer
Throws
Exception Description
\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
Name Type Description
$dn string|array|\Zend_Ldap_Dn
$objectClass array
Returns
Type Description
\Zend_Ldap_Node
Throws
Exception Description
\Zend_Ldap_Exception
methodpubliccurrent( ) : array

Return the current attribute.

Implements Iterator

Returns
Type Description
array
methodpublicdelete( ) : \Zend_Ldap_Node

Marks this node as to be deleted

Node will be deleted on calling update() if $delete is true.

Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
methodpublicdeleteAttribute( string $name ) : \Zend_Ldap_Node

Deletes a LDAP attribute.

This method deletes the attribute.

This is an offline method.

Parameters
Name Type Description
$name string
Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicdetachLdap( ) : \Zend_Ldap_Node

Detach node from LDAP connection

This is an offline method.

Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
methodpublicexists( \Zend_Ldap $ldap = null ) : boolean

Check if node exists on LDAP.

This is an online method.

Parameters
Name Type Description
$ldap \Zend_Ldap
Returns
Type Description
boolean
Throws
Exception Description
\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
Name Type Description
$data array
$fromDataSource boolean
Returns
Type Description
\Zend_Ldap_Node
Throws
Exception Description
\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
Name Type Description
$dn string|array|\Zend_Ldap_Dn
$ldap \Zend_Ldap
Returns
Type Description
\Zend_Ldap_Node|null
Throws
Exception Description
\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
Type Description
array
methodpublicgetChanges( ) : array

Returns all changes made.

This is an offline method.

Returns
Type Description
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
Type Description
\Zend_Ldap_Node_ChildrenIterator
Throws
Exception Description
\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
Type Description
\Zend_Ldap_Dn
methodpublicgetLdap( ) : \Zend_Ldap

Gets the current LDAP connection.

Returns
Type Description
\Zend_Ldap
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicgetParent( \Zend_Ldap $ldap = null ) : \Zend_Ldap_Node

Returns the parent of the current node.

Parameters
Name Type Description
$ldap \Zend_Ldap
Returns
Type Description
\Zend_Ldap_Node
Throws
Exception Description
\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
Type Description
boolean
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicisAttached( ) : boolean

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

This is an offline method.

Returns
Type Description
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
Type Description
boolean
methodpublickey( ) : string

Return the attribute name.

Implements Iterator

Returns
Type Description
string
methodpublicmove( \Zend_Ldap_Dn|string|array $newDn ) : \Zend_Ldap_Node

{@see setDn()}

This is an offline method.

Parameters
Name Type Description
$newDn \Zend_Ldap_Dn|string|array
Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
Throws
Exception Description
\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
Name Type Description
$name string
$value mixed
Returns
Type Description
null
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicoffsetUnset( string $name ) : null

Deletes a LDAP attribute.

Implements ArrayAccess.

This method deletes the attribute.

This is an offline method.

Parameters
Name Type Description
$name string
Returns
Type Description
null
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicreload( \Zend_Ldap $ldap = null ) : \Zend_Ldap_Node

Reload node attributes from LDAP.

This is an online method.

Parameters
Name Type Description
$ldap \Zend_Ldap
Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicremoveDuplicatesFromAttribute( string $attribName ) : void

Removes duplicate values from a LDAP attribute

Parameters
Name Type Description
$attribName string
methodpublicremoveFromAttribute( string $attribName, mixed|array $value ) : void

Remove given values from a LDAP attribute

Parameters
Name Type Description
$attribName string
$value mixed|array
methodpublicrename( \Zend_Ldap_Dn|string|array $newDn ) : \Zend_Ldap_Node

{@see setDn()}

This is an offline method.

Parameters
Name Type Description
$newDn \Zend_Ldap_Dn|string|array
Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
Throws
Exception Description
\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
Name Type Description
$filter string|\Zend_Ldap_Filter_Abstract
$sort string
Returns
Type Description
\Zend_Ldap_Node_Collection
Throws
Exception Description
\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
Name Type Description
$filter string|\Zend_Ldap_Filter_Abstract
$scope integer
$sort string
Returns
Type Description
\Zend_Ldap_Node_Collection
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicsetAttribute( string $name, mixed $value ) : \Zend_Ldap_Node

Sets a LDAP attribute.

This is an offline method.

Parameters
Name Type Description
$name string
$value mixed
Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
Throws
Exception Description
\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
Name Type Description
$name string
$value integer|array
$utc boolean
Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
Throws
Exception Description
\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
Name Type Description
$newDn \Zend_Ldap_Dn|string|array
Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicsetObjectClass( array|string $value ) : \Zend_Ldap_Node

Sets the objectClass.

This is an offline method.

Parameters
Name Type Description
$value array|string
Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
Throws
Exception Description
\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
Name Type Description
$password string
$hashType string
$attribName string
Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
Throws
Exception Description
\Zend_Ldap_Exception
methodpublictoLdif( array $options = array() ) : string

Returns a LDIF representation of the current node

Parameters
Name Type Description
$options array

Additional options used during encoding

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

Sends all pending changes to the LDAP server

Parameters
Name Type Description
$ldap \Zend_Ldap
Returns
Type Description
\Zend_Ldap_Node Provides a fluid interface
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicvalid( ) : boolean

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

Implements Iterator

Returns
Type Description
boolean
methodpublicwillBeDeleted( ) : boolean

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

Returns
Type Description
boolean
methodpublicwillBeMoved( ) : boolean

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

Returns
Type Description
boolean
Documentation was generated by DocBlox 0.15.1.