[Ape] LDAP for APE

Steven Lee steven.k.lee at gmail.com
Tue Sep 7 15:42:45 EDT 2004


Firstable, thanks to Shane and co. for creating wonderful APE for
Zope.  It has great potential for various adaptations and
implementation to extend Zope beyond ZODB.

I am trying to see if I can use Open LDAP to store few Zope objects
(users, acls, folders, and workgroups) and APE seems to be able to
provide perfect solution for this.  Unfortunately, there are no LDAP
mapper available for APE yet but it seems very possible to write my
own mapper.

I have Open LDAP installed and also have Python-LDAP installed for
Zope.  So Zope can make python calls to read and manipulate Open LDAP
server.

Currently, I am stuck at mapper.py.  Here's the code:
----------------------------------------------
def create_ldap_mapper(module_name, **kw):
    """LDAP mapper factory..
    Returns (mapper, { name -> connection})
    
    Usage in database configuration file:
    factory=apelib.zope2.mapper.create_ldap_mapper
    module_name=ldap
    params=
    kwparams=ldap_server, ldap_port, bind_dn, bind_pw
    """
    from apelib.ldap.openldap import OpenLDAPConnector
    
    mapper = load_conf('ldap', search_products=1)
    conn = OpenLDAPConnector(module_name, **kw)
    return mapper,{'ldap': conn}
-----------------------------------------------

It appears that I need to create OpenLDAPConnector class.  But
python-ldap already has a class that returns ldap connection object,
so I am wondering if I need to create one or just wrapper/interface to
python-ldap class.  I was hoping to get a good example from sql
mapper, but I can't seem to be able to find "DBAPIConnector", which is
suppose to be from apelib.sql.dbapi.  Where can I find DBAPIConnector
class spec?  What needs to be in the connector class?

Any other pointers to making LDAP work with APE would be GREATLY
appreciated.  Thanks!

Steven Lee, developer, AT&T GSI


More information about the Ape mailing list