LDAPAdminDownload now

OverviewNewsScreenshotsDocumentationDownloadForums

LDAP Admin: Template examples

Template examples

This simplest possible template defines one attribute. Since there is no control defined, default control for the attribute type text will be used (edit field).
<template>
   <name>LDAP Adressbook</name>

   <attribute type="text">
      <name>sn</name>
   </attribute>
</template>
This template could be used to edit one attribute in existing object. To create new objects, however, we need objectclass information. We add it as "hidden" attribute (no default control type) with default values:
<template>
   <name>LDAP Adressbook</name>
      
   <attribute>
      <name>objectclass</name>
      <value>top</value>
      <value>inetOrgPerson</value>         
   </attribute>
      
   <attribute type="text">
      <name>sn</name>
   </attribute>
</template>
Now, we could use this template to create new object. Let's extend this template with two more attributes and a parameterized default value:
<template>
   <name>LDAP Adressbook</name>

   <attribute>
      <name>objectclass</name>
      <value>top</value>
      <value>inetOrgPerson</value>         
   </attribute>
      
   <attribute type="text">
      <name>givenName</name>
   </attribute>
      
   <attribute type="text">
      <name>sn</name>
   </attribute>

   <attribute type="text">
      <name>cn</name>
      <value>%givenName%.%sn%</value>
   </attribute>
</template>
Up to now, all attributes are using default controls. The following example extends the functionality with the field containing a combo control:
<template>
   <name>LDAP Adressbook</name>      
   <rdn>cn</rdn>
      
   <attribute>
      <name>objectclass</name>
      <value>top</value>
      <value>inetOrgPerson</value>         
   </attribute>
      
   <attribute type="text">
      <name>givenName</name>
   </attribute>
      
   <attribute type="text">
      <name>sn</name>
   </attribute>

   <attribute type="text">
      <name>cn</name>
      <value>%givenName%.%sn%</value>
   </attribute>

   <attribute type="text">
      <name>title</name>
      <control type="combo">
         <items>
            <item>Vice President</item>
            <item>Administrator</item>
            <item>Product Manager</item>
         </items>
      </control>
   </attribute>
</template>
To let LdapAdmin know which attribute should be used to form the object DN when creating new entry we have added <rdn> tag with the value of cn, indicating that the attribute cn and its value should be used. We now have simple and functioning template which can easily be further extended to support e-mails, photos etc. You can download such sample LDAP Adressbook template here:
LDAP InetOrg Adressbook Template


Copyright (C) 2012 Tihomir Karlovic & www.ldapadmin.org. All rights reserved.   Design by Alexander Sokoloff. Impressum
LDAP Admin