Description

    This product features an Archetypes storage that stores field values in
    an LDAP directory.

Usage

    See directory 'examples/' for some examples of content types using
    LDAPStorage.

    There are some issues regarding LDAPStorage and Archetypes:

        - the storage initialization requires the following parameters:

            - the LDAP RDN attribute. For example, in the folowing LDAP
              entry, the RDN attribute is 'cn':

                dn: cn=johndoe,dc=localhost,dc=localdomain
                objectClass: inetOrgPerson
                uid: johndoe
                cn: johndoe
                sn: John Doe

            - the attribute that should be used to get the RDN value. It can
            be a method, archetypes field or instance variable from which
            the value will be retrieved to construct the entry DN.

            NOTES:

            1) If an archetypes field is used, it must be using 
            LDAPStorage and you must ensure that the field is the RDN 
            field that you defined and its attribute is the RDN attribute. 

            2) If you want to use a field that is not in LDAP, 
            you should use its accessor, but note that LDAPStorage won't be 
            able to know when its value changes. So, be sure that methods or
            variables used as RDN mapping are not mutable.

            - the LDAP attribute to store the value from this field;

            The following example is correct:

                ...
                StringField(
                    'name',
                    storage = LDAPStorage(
                        'cn',
                        'name',
                        'cn',
                        default_attrs = {
                            'objectClass': ['inetOrgPerson'],
                        },
                        required_attrs = ['sn', 'cn'],
                    ),
                ),
                ...

            The following example would raise the exception
            'InvalidRDNError':

                ...
                StringField(
                    'name',
                    storage = LDAPStorage(
                        'cn',
                        'organization',
                        'cn',
                        default_attrs = {
                            'objectClass': ['inetOrgPerson'],
                        },
                        required_attrs = ['sn', 'cn'],
                    ),
                ),
                ...

        - it has also some additional parameters:

            - a dictionary of common attributes. This dictionary will be
            used to set default values in certain LDAP attributes, at the
            creation of new entries. For example, this dictionary could be:

                >>> default_attrs = {'objectClass': 'inetOrgPerson'}

            - list of required attributes in LDAP schema. It will tell the
            storage what fields are required in LDAP, so it knows they must
            be included in initialization. For example, the list, assuming
            that the only object class used is 'inetOrgPerson', would be:

                >>> required_attrs = ['sn', 'cn']

        - the usage of this storage assumes that the defined schemas 
        (LDAP and Archetypes) are compatible. Attributes that are required 
        in LDAP schema, should be also required in Archetypes schema. 

Tests

    To run unit tests you need to have a configured LDAP server, and fill
    the settings in tests/config file.

Requirements

    - CMFPlone 3.0

    - Archetypes 1.4

    - python-ldap

    - LDAPConnection 0.1a1 or newer

Todo
    
    Read file todo.txt for details.


Copyright

    Ricardo Alves <rsa at eurotux dot com>

    Eurotux Development Team <udp at eurotux dot com>

License

    This software is released under GPL v2. Read LICENSE.txt
