[Zope3-dev] Re: LDAP Authentication source

Nicolas Évrard nicoe at no-log.org
Mon Jun 28 05:36:01 EDT 2004


* Philipp von Weitershausen  [11:09 28/06/04 CEST]: 
>Nicolas Évrard wrote:
>
>>Hello,
>>
>>I'm currently continuing my journey in zope3 and I stumble accross the
>>NewPrincipalSource recipe. So instead of copying it verbatim, I tried to
>>do a ldap version of this one.
>
>Great! If you think you are ready to share your work, consider 
>contributing it to the z3 base project, http://codespeak.net/z3/

Ok I'll implement the adapter, I also recently found a way to add
unittest without having an LDAP server running. Once these two things
are in I'll upload the package.

BTW, while surfing the z3 stuff, I've seen a calendaring project I might
have code for it. It's a parser that take a reccurence-specification and
transform it into an iterator but there is also a method to check if a
date respect the reccurence-spec without doing a simple 'in'. The code
is not very pythonic (it's adapted from a Thunderbird file I've found).

>>I'm now thinking about extending this little product. Adding caching,
>>and maybe a specialized principal for ldap.
>>
>>But I wonder, is it really usefull to add such a specialized principal ?
>>Because in a certain sense this kind of code seems neat:
>>
>>    >>> foo = source.getPrincipal('foo')
>>    >>> print foo.sn
>>    'Fee Fi Fo fun for me'
>>
>>But this kind of information is not related to security and might
>>(should ?) take place somewhere else.
>
>Indeed, the interface that describes principals, IPrincipal, is only 
>about security-related information. A good way would probably to have an 
>extra interface, e.g. ILDAPNode, and adapt principals to it:

Ok I had the feeling by reading the previous message of Stephan that
adapters were to the way to go but the step I was missing was to create
an extra interface. One more question: this interface should also be
used by other stuff, is ldapauth the right place to put it ?

>   >>> foo = source.getPrincipal('foo')
>   >>> ldap = ILDAPNode(foo)
>   >>> print ldap.sn
>   Fee Fi Fo fun for me

Really neat.

>The underlying implementation could actually do:
>
>   class LDAPPrincipal(object):
>       implements(IPrincipal, ILDAPNode)
>
>       ...
>
>If an object is adapted to an interface it already provides, the object 
>itself is returned...

OK many thanks.

-- 
(°>  Nicolas Évrard
/ )  Liège - Belgique
^^   


More information about the Zope3-dev mailing list