[Mailman-Users] LDAP and case-sensitive memberlist - UPDATE

Chris Nulk CNulk at scu.edu
Tue Mar 31 22:57:31 CEST 2009

Hello all,

Earlier this month, I asked about an issue I was having with the LDAPMembership adaptor and case-sensitivity.  Mark Sapiro most graciously helped me with the problem including making several changes to the LDAPMemberships.py file.  Mark was an outstanding help and resource for myself, knowing as little as I do of Python.

While somewhat documented in the file, I will mention some of the changes here.

1. __members is now a dictionary keyed by LCE with CPE as the values (straight from what Mark told me :) )

2. the getMemberName() method returns None if the member has no 'cn' value.

3. I added several additional fields (which we use here) to be retrieved from the LDAP database - GivenName, PreferredName, sn, and FullName.   GivenName and sn should probably common to most LDAP databases since they generally refer to a person's given/first name and their surname/lastname.  PreferredName and FullName may not be generally available.  PreferredName is what a person prefers to be called (i.e.  Jim instead of James).  FullName is simply the Given/First name and the Surname/lastname.

4. To help support 3. above, new mm_cfg.py settings were created - LDAP_DEFAULT_GIVENNAME, LDAP_NAME_SEPARATOR, and LDAP_SURNAME_FIRST.   These settings only apply to the 'displayable' name (__member_names).
   LDAP_DEFAULT_GIVENNAME allows you to provide a default givenname for an entry without one defined (say 'Unknown') [Default value = ''].  
   LDAP_NAME_SEPARATOR allows you to specify what string of characters you want to use to separate the Given/Preferred name from the Surname/Lastname.  [Default value = ''].
   LDAP_SURNAME_FIRST allows you to specify whether the surname/lastname or the given/preferred name should be first.  [Default value = 0/False].

   When building the value for __member_names, the code first checks for 'sn'.  If found, it then checks 'preferredname', 'givenname', and LDAP_DEFAULT_NAME in order and uses the first available choice.  With both a preferred/given name and a surname/lastname, the __member_names is built according to LDAP_NAME_SEPARATOR and LDAP_SURNAME_FIRST settings.  If 'sn' is not found, then 'fullname' is checked and used if available.  If 'fullname' is not available, then 'cn' is checked and used if available.  Otherwise None is returned.

Those are the basics to the changes.

I am attaching the latest version of LDAPMemberships.py to this message.  It should be text/plain but who knows.  If the attachment is stripped and several ask for the file, I will repost with the file included in the message (if allowed by the moderator).

Thanks to all that help,


More information about the Mailman-Users mailing list