Using LDAP with NARVAL

Adrien DI MASCIO


Table of Contents

Install and setup
Install
Howto the LDAP recipes

Abstract

This HOW-TO explains how to use the LDAP recipes from the PIA package.

Install and setup

Install

Install the PIA package with the npm program npm (in the "narval" directory of NARVAL):

        npm.py install pia.tgz
      
Else you can prefer using HORN to do it, by clicking the 'Install package' item from the 'File' menu of the main window.

To use PIA's scheduling negociation you'll need NARVAL's negociation package too which you can install in the same way. If you're only interested with using LDAP, you don't have to install the negociation package.

Howto the LDAP recipes

You'll find, in this LDAP package, the very basic LDAP commands :

  • the "consult" recipe which allows you to see what is in the LDAP directory. For this, NARVAL will search in his memory an "asked-dn" element which must contain the DN you want to consult. You may also want to refine your search by precising the scope type of your search, or by giving a specific objectclass. For example, the following elements :

                
    	     <asked-dn objectclass='narvalassistant' scope-type='SUBTREE'>dc=logilab, dc=fr</asked-dn>
                
               
    will indicate that you want to search for all objects of type "narvalassistant" which depends on the DN 'dc=logilab, dc=fr'. The scope-type attribute is here to precise the tree structure you want to search in. Possibles values are : BASE , which means you want to search the object itself, ONELEVEL , which means you want to search the object's immediate children, and SUBTREE , which means you want to serach the object and all its descendants.

    The objectclass and scope-type attributes are optional. Default values are "*" for objectclass, and SUBTREE for scope-type.

  • You may want to modify some entries in the ldap directory. The LDAP module in NARVAL offers the possibility to do this just as if you would want to do it in a shell. For this, you should use the 'auto_modify' recipe which automatically modify the ldap directory when a 'ldap-modifs' element is found in NARVAL's memory. The ldap-modifs element must have a list of childs which represent each one a modification you want to do. You can either add an attribute ('add-attr'), add an entry ('add-entry'), replace an attribute value ('replace-attr')or remove an attribute ('remove-attr'). For each modification type, you must specify a name attribute, which either represents the attribute name or the entry name, and a value attribute which contains the attribute or entry's value you want to store.

    For example, assuming that we would want to change the 'email' attribute and add a 'givenname' attribute to the object represented by the following DN : 'dc=logilab, dc=fr, cn=me, ou=people', we would add in NARVAL's memory the following elements :

               
                <asked-dn>dc=logilab, dc=fr, cn=me, ou=people</asked-dn>
                <ldap-modifs>
                  <replace-attr name='email' value='me@logilab.fr'/>
                  <add-attr name='givenname' value='adim'/>
                </ldap-modifs>
                
              
    In this case, the new value of the email attribute would be : me@logilab.fr

As this module was developped in order to be used as a part of the negociation package, some recipes were built to simplify the access to "narvalassistant" definition in the Ldap base. For example, you can use the following recipes :

  • turn_assistant_on which will update the Ldap directory to indicate that your assisant is now connected and the port/machine he's listening on. The only requirement for this recipe is that you must hace an agent-name element in NARVAL's memory which would contain you agent's name.

  • turn_assistant_off which will update the Ldap directory to indicate that your assisant is now disconnected. The only requirement for this recipe is that you must hace an agent-name element in NARVAL's memory which would contain you agent's name.

  • remove_agent which will remove from the base your agent. This should only use in order to remove it from base definitly. In other cases, you should use the other recipes or LDAP's module functionalities. The only requirement for this recipe is that you must hace an agent-name element in NARVAL's memory which would contain you agent's name.

  • add_agent recipe which allows you to add your personal assistant in the LDAP directory. The only thing you have to do is to launch the "add_agent" recipe with an "agent-def" element in NARVAL's memory. An agent-def element must be structured as follows :

               
                <agent-def> 
                 <name>my-agent-name</name>
                 <address>machine:port</address>
                 <owner>
                   <name>my-name</name>
                   <email>my-email</email>
                 </owner>
                </agent-def>
               
             

As the agent-name element is nearly always used, you should store it once for all in your memory.xml.