Template Class

package phpLDAPadmin
subpackage Templates
todo RDN attributes should be treated as MUST attributes even though the schema marks them as MAY
todo RDN attributes need to be checked that are included in the schema, otherwise mark it is invalid
todo askcontainer is no longer used?

 Methods

OnChangeAdd javascript processing

OnChangeAdd($origin, $value) 

Parameters

$origin

$value

__clone()

__clone() 

__construct()

__construct($server_id, $name, $filename, $type, $id) 

Parameters

$server_id

$name

$filename

$type

$id

This function will perform the following intialisation steps: + If a DN is set, query the ldap and load the object + Read our $_REQUEST variable and set the values After this action, the template should self describe as to whether it is an update, create or delete.

accept($makeVisible) 

(OLD values are IGNORED, we will have got them when we build this object from the LDAP server DN.)

Parameters

$makeVisible

Add another attribute to this template

addAttribute($name, $value, $source) : int
Inherited

inherited_from \xmlTemplate::addAttribute()

Parameters

$name

$value

$source

Returns

intAttribute ID

Copy a DN

copy($template, $rdn, $asnew) 

Parameters

$template

$rdn

$asnew

Get Attributes by LDAP type This function will return a list of attributes by LDAP type (MUST,MAY).

getAttrbyLdapType($type) : array

Parameters

$type

Returns

arrayArray of attributes.

Get a specific Attribute

getAttribute(string $name) : object
Inherited

inherited_from \xmlTemplate::getAttribute()

Parameters

$name

string

Name of attribute to retrieve

Returns

objectAttribute

Get the attribute names

getAttributeNames() : array
Inherited

inherited_from \xmlTemplate::getAttributeNames()

Returns

arrayArray of attributes Names

Get the attribute entries

getAttributes(boolean $optional) : array

Parameters

$optional

boolean

Include the optional attributes

Returns

arrayArray of attributes

Return a list of the internal attributes

getAttributesInternal() 

Return a list of attributes that should be shown

getAttributesShown() 

Get available attributes

getAvailAttrs() 

Get the DN of the container for this entry

getContainer() : \dn

Returns

\dnDN of the container

getContainerEncode()

getContainerEncode($url) 

Parameters

$url

Determine the type of template this is

getContext() 

Display the DN for this template entry.

getDN() : \dn

If the DN is not set (creating a new entry), then a generated DN will be produced, taken from the RDN and the CONTAINER details.

Returns

\dn

getDNEncode()

getDNEncode($url) 

Parameters

$url

Return the template description

getDescription() : string

Returns

stringDescription

Get the Template filename.

getFileName() 
Inherited

inherited_from \xmlTemplate::getFileName()

Get the attributes that are marked as force delete We'll cache this result in the event of multiple calls.

getForceDeleteAttrs() 

Return the template by ID

getID() 
Inherited

inherited_from \xmlTemplate::getID()

Get template icon

getIcon() 

Return an array, that can be passed to ldap_add().

getLDAPadd($attrsOnly) 

Attributes with empty values will be excluded.

Parameters

$attrsOnly

Return an array, that can be passed to ldap_mod_replace().

getLDAPmodify(boolean $attrsOnly, $index) 

Only attributes that have changed their value will be returned.

This function will cache its results, so that it can be called with count() to see if there are changes, and if they are, the 2nd call will just return the results

Parameters

$attrsOnly

boolean

Return the attribute objects (useful for a confirmation process), or the modification array for ldap_modify()

$index

Return the template name

getName(boolean $lower) 
Inherited

inherited_from \xmlTemplate::getName()

Parameters

$lower

boolean

Force the name to be lowercase (default)

Return the objectclasses defined in this template

getObjectClasses() : array

Returns

arrayArray of Objects

Return the RDN for this template.

getRDN() : \rdn

If the DN is already defined, then the RDN will be calculated from it. If the DN is not set, then the RDN will be calcuated from the template attribute definitions

Returns

\rdnRDN for this template

Return the attribute name part of the RDN

getRDNAttributeName() 

Get all the RDNs for this template, in RDN order.

getRDNAttrs() : array

Returns

arrayRDNs in order.

Get the Template read time.

getReadTime() 
Inherited

inherited_from \xmlTemplate::getReadTime()

getRegExp()

getRegExp() 

Get template title

getTitle() 
Inherited

inherited_from \xmlTemplate::getTitle()

Return the template type

getType() 
Inherited

inherited_from \xmlTemplate::getType()

May be overloaded in other classes

isAdminDisabled() 

Return true if this is a MUST,MAY attribute

isAttrType($attr, $type) 

Parameters

$attr

$type

Get the template validity or the reason it is invalid

isInValid() : string

Returns

stringInvalid reason, or false if not invalid

isNoLeaf()

isNoLeaf() 

Test if this template has been marked as a read-only template

isReadOnly() 

Test if a template is of a type

isType($type) : boolean
Inherited

inherited_from \xmlTemplate::isType()

Parameters

$type

Returns

boolean

Test if the template is visible

isVisible() : boolean

Returns

boolean

Set the container for this template, if we are creating entries

setContainer(\dn $container) 

todo Trigger a query to the LDAP server and generate an error if the container doesnt exist

Parameters

$container

\dn

The DN of the container

Set the DN for this template, if we are editing entries

setDN(\dn $dn) 

Parameters

$dn

\dn

The DN of the entry

Set a template as invalid

setInvalid(string $msg, $admin) 

Parameters

$msg

string

Message indicating the reason the template has been invalidated

$admin

setInvisible()

setInvisible() 

Set the RDN attributes Given an RDN, mark the attributes as RDN attributes.

setRDNAttributes($rdn) : \RDN

If there is no defined attribute, then the remaining RDNs will be returned.

Parameters

$rdn

RDN

Returns

\RDNattributes not processed

setVisible()

setVisible() 

Get an attribute ID

getAttrID(string $attr) : int
Inherited

inherited_from \xmlTemplate::getAttrID()

Parameters

$attr

string

The Attribute being searched.

Returns

intAttribute ID in the array

Return this LDAP Server object

getServer() : object
Inherited

inherited_from \xmlTemplate::getServer()

Returns

objectDataStore Server

Return the LDAP server ID

getServerID() : int
Inherited

inherited_from \xmlTemplate::getServerID()

Returns

intServer ID

Is default templates enabled? This will disable the default template from the engine.

hasDefaultTemplate() : boolean

Returns

boolean

Return the templates of type (creation/modification)

readTemplates(\$string $type) : array

Parameters

$type

\$string

type - creation/modification

Returns

array- Array of templates of that type

Main processing to store the template.

storeTemplate(\xmldata $xmldata) 

Parameters

$xmldata

\xmldata

Parsed xmldata from xml2array object

Return the attributes that comprise the RDN.

getRDNObjects() : array

Returns

arrayArray of RDN objects

This functions main purpose is to discover our MUST attributes based on objectclass definitions in the template file and to discover which of the objectclasses are STRUCTURAL - without one, creating an entry will just product an LDAP error.

rebuildTemplateAttrs() 

Set the LDAP type property for an attribute

setAttrLDAPtype(object $attr, string $value) 

Parameters

$attr

object

Attribute

$value

string

(MUST,MAY,OPTIONAL)

Set the minimum number of values for an attribute

setMinValueCount(object $attr, $value) 

Parameters

$attr

object

Attribute

$value

int

 Properties

 

$title

$title 

 

$attributes

$attributes 
Inherited

inherited_from \xmlTemplate::$$attributes
 

$container

$container 

 

$description

$description 

 

$filename

$filename 
Inherited

inherited_from \xmlTemplate::$$filename
 

$id

$id 
Inherited

inherited_from \xmlTemplate::$$id
 

$name

$name 
Inherited

inherited_from \xmlTemplate::$$name
 

$readtime

$readtime 
Inherited

inherited_from \xmlTemplate::$$readtime
 

$server_id

$server_id 
Inherited

inherited_from \xmlTemplate::$$server_id
 

$structural_oclass

$structural_oclass 

 

$type

$type 
Inherited

inherited_from \xmlTemplate::$$type
 

$dn

$dn 

 

$icon

$icon 

 

$invalid

$invalid 

 

$invalid_admin

$invalid_admin 

 

$invalid_reason

$invalid_reason 

 

$noleaf

$noleaf 

 

$rdn

$rdn 

 

$readonly

$readonly 

 

$regexp

$regexp 

 

$visible

$visible