Templates are either:
+ Creating or Editing, (a Container or DN passed to the object)
+ A predefined template, or a default template (template ID passed to the object)
The template object will know which attributes are mandatory (MUST
attributes) and which attributes are optional (MAY attributes). It will also
contain a list of optional attributes. These are attributes that the schema
will allow data for (they are MAY attributes), but the template has not
included a definition for them.
The template object will be invalidated if it does contain the necessary
items (objectClass, MUST attributes, etc) to make a successful LDAP update.
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. (OLD values are IGNORED, we will have got them when we build this object from the LDAP server DN.)
Arguments
Name
Type
Description
Default
$makeVisible
n/a
false
Return value
Type
Description
n/a
n/a
copy(
$template,
$rdn,
$asnew
= false,
)
:
n/a
Description
Copy a DN
Arguments
Name
Type
Description
Default
$template
n/a
$rdn
n/a
$asnew
n/a
false
Return value
Type
Description
n/a
n/a
getAttrbyLdapType(
$type,
)
:
array
Description
Get Attributes by LDAP type
This function will return a list of attributes by LDAP type (MUST,MAY).
Arguments
Name
Type
Description
Default
$type
n/a
Return value
Type
Description
array
Array of attributes.
getAttributes(
$optional
= false,
)
:
array
Description
Get the attribute entries
Arguments
Name
Type
Description
Default
$optional
n/a
false
Return value
Type
Description
array
Array of attributes
getAttributesInternal(
)
:
n/a
Description
Return a list of the internal attributes
Return value
Type
Description
n/a
n/a
getAttributesShown(
)
:
n/a
Description
Return a list of attributes that should be shown
Return value
Type
Description
n/a
n/a
getAvailAttrs(
)
:
n/a
Description
Get available attributes
Return value
Type
Description
n/a
n/a
getContainer(
)
:
\dn
Description
Get the DN of the container for this entry
Return value
Type
Description
\dn
DN of the container
getContainerEncode(
$url
= true,
)
:
n/a
Arguments
Name
Type
Description
Default
$url
n/a
true
Return value
Type
Description
n/a
n/a
getContext(
)
:
n/a
Description
Determine the type of template this is
Return value
Type
Description
n/a
n/a
getDN(
)
:
\dn
Description
Display the DN for this template entry. 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.
Return value
Type
Description
\dn
getDNEncode(
$url
= true,
)
:
n/a
Arguments
Name
Type
Description
Default
$url
n/a
true
Return value
Type
Description
n/a
n/a
getDescription(
)
:
string
Description
Return the template description
Return value
Type
Description
string
Description
getForceDeleteAttrs(
)
:
n/a
Description
Get the attributes that are marked as force delete
We'll cache this result in the event of multiple calls.
Return value
Type
Description
n/a
n/a
getIcon(
)
:
n/a
Description
Get template icon
Return value
Type
Description
n/a
n/a
getLDAPadd(
$attrsOnly
= false,
)
:
n/a
Description
Return an array, that can be passed to ldap_add(). Attributes with empty values will be excluded.
Return an array, that can be passed to ldap_mod_replace(). 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
Arguments
Name
Type
Description
Default
$attrsOnly
n/a
false
$index
n/a
0
Return value
Type
Description
n/a
n/a
getObjectClasses(
)
:
array
Description
Return the objectclasses defined in this template
Return value
Type
Description
array
Array of Objects
getRDN(
)
:
\rdn
Description
Return the RDN for this template. 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
Return value
Type
Description
\rdn
RDN for this template
getRDNAttributeName(
)
:
n/a
Description
Return the attribute name part of the RDN
Return value
Type
Description
n/a
n/a
getRDNAttrs(
)
:
array
Description
Get all the RDNs for this template, in RDN order.
Return value
Type
Description
array
RDNs in order.
getRDNObjects(
)
:
array
Description
Return the attributes that comprise the RDN.
Return value
Type
Description
array
Array of RDN objects
getRegExp(
)
:
n/a
Return value
Type
Description
n/a
n/a
hasDefaultTemplate(
)
:
boolean
Description
Is default templates enabled?
This will disable the default template from the engine.
Return value
Type
Description
boolean
isAdminDisabled(
)
:
n/a
Return value
Type
Description
n/a
n/a
isAttrType(
$attr,
$type,
)
:
n/a
Description
Return true if this is a MUST,MAY attribute
Arguments
Name
Type
Description
Default
$attr
n/a
$type
n/a
Return value
Type
Description
n/a
n/a
isInValid(
)
:
string
Description
Get the template validity or the reason it is invalid
Return value
Type
Description
string
Invalid reason, or false if not invalid
isNoLeaf(
)
:
n/a
Return value
Type
Description
n/a
n/a
isReadOnly(
)
:
n/a
Description
Test if this template has been marked as a read-only template
Return value
Type
Description
n/a
n/a
isVisible(
)
:
boolean
Description
Test if the template is visible
Return value
Type
Description
boolean
readTemplates(
$type,
)
:
array
Description
Return the templates of type (creation/modification)
Arguments
Name
Type
Description
Default
$type
n/a
Return value
Type
Description
array
- Array of templates of that type
rebuildTemplateAttrs(
)
:
n/a
Description
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.
Return value
Type
Description
n/a
n/a
setAttrLDAPtype(
$attr,
$value,
)
:
n/a
Description
Set the LDAP type property for an attribute
Arguments
Name
Type
Description
Default
$attr
n/a
$value
n/a
Return value
Type
Description
n/a
n/a
setContainer(
$container,
)
:
n/a
Description
Set the container for this template, if we are creating entries
Arguments
Name
Type
Description
Default
$container
n/a
Return value
Type
Description
n/a
n/a
Tags
Name
Description
todo
Trigger a query to the LDAP server and generate an error if the container doesnt exist
setDN(
$dn,
)
:
n/a
Description
Set the DN for this template, if we are editing entries
Arguments
Name
Type
Description
Default
$dn
n/a
Return value
Type
Description
n/a
n/a
setInvalid(
$msg,
$admin
= false,
)
:
n/a
Description
Set a template as invalid
Arguments
Name
Type
Description
Default
$msg
n/a
$admin
n/a
false
Return value
Type
Description
n/a
n/a
setInvisible(
)
:
n/a
Return value
Type
Description
n/a
n/a
setMinValueCount(
$attr,
$value,
)
:
n/a
Description
Set the minimum number of values for an attribute
Arguments
Name
Type
Description
Default
$attr
n/a
$value
n/a
Return value
Type
Description
n/a
n/a
setRDNAttributes(
$rdn,
)
:
\RDN
Description
Set the RDN attributes
Given an RDN, mark the attributes as RDN attributes. If there is no defined attribute,
then the remaining RDNs will be returned.