[ mailman-Patches-871062 ] A MemberAdaptor for LDAP-based membership

SourceForge.net noreply at sourceforge.net
Tue Jan 20 11:53:41 EST 2004

Patches item #871062, was opened at 2004-01-05 12:09
Message generated for change (Comment added) made by fubarobfusco
You can respond by visiting: 

Category: list administration
Group: Mailman 2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: K. A. Krueger (fubarobfusco)
Assigned to: Nobody/Anonymous (nobody)
Summary: A MemberAdaptor for LDAP-based membership

Initial Comment:
This is a module, LDAPMemberships, which extends MemberAdaptor to support membership lists based on a search in an enterprise LDAP directory. With this module, you can make mailing lists which, rather than having a list of member addresses stored in the list, query your LDAP server for member addresses whenever necessary.

For instance, if you wish to have a mailing list of all the Vice Presidents in your company, you can express this as an LDAP search: "(title=Vice President*)" and create a mailing list which performs this search and delivers mail to the resulting user accounts when a message is sent to it. This way, rather than manually adding new Vice Presidents to the mailing list, you can simply have Human Resources update the LDAP records, and the change will immediately take effect for the mailing list.

Mailman lists with LDAP-based membership can still have moderators, list policies, and the other usual features of Mailman lists. There are a few missing features; notably:

1. There is no bounce processing.
2. There are no per-user preferences.
3. The Web interface still allows you to try setting user preferences, but if you do you will get a stack thrown at you. (Only the "readable" interface of MemberAdaptor is implemented.)
4. The LDAP settings of a list (e.g. LDAP server and search string) are only administrable by editing its "extend.py" file, not over the Web.
5. There is no digest mode.

To use this module, you must have the "ldap" Python module installed (aka "python-ldap"). Then just put LDAPMemberships.py in the "Mailman" directory (~mailman/Mailman), create a new list, and write an "extend.py" file in the list directory like so:

from Mailman.LDAPMemberships import LDAPMemberships

def extend(list):
    ldap = LDAPMemberships(list)
    ldap.ldapsearch = "(title=Vice President*)"  # members search string
    ldap.ldapserver = "ldap.example.net"  # your enterprise LDAP server
    ldap.ldapbasedn = "dc=Example dc=net"  # your LDAP base DN
    ldap.ldapbinddn = ''   # a bind DN which can read people's 'mail' field
    ldap.ldappasswd = ''   # the password for the bind DN
    list._memberadaptor = ldap

This module has been tested at my site and is in production on a Mailman 2.1.2 installation.


>Comment By: K. A. Krueger (fubarobfusco)
Date: 2004-01-20 11:53

Logged In: YES 

I've uploaded a new version (0.2) of LDAPMemberships.py. This one is some ungodly number of times faster, as it does not do redundant LDAP queries in a single load.


Comment By: K. A. Krueger (fubarobfusco)
Date: 2004-01-05 12:18

Logged In: YES 

Er. SF ate the indentation on my "extend.py" example in the patch description. All of the lines after "def extend(list):" are meant to be indented once.


You can respond by visiting: 

More information about the Mailman-coders mailing list