[Pharo-project] Pharo & LDAP

Schwab,Wilhelm K bschwab at anest.ufl.edu
Wed Feb 16 15:50:01 CET 2011

I have used LDAPlayer with good results.  There are small problems on Pharo - a DNU over #and:and: IIRC.  As the self-appointed silent failure pedant, I would like to suggest a change to your code.  Please try/consider (untested code):

attrAt: aKey ifNone:ifNone
     | selected |
     selected := attrs at:aKey ifPresent:[ :value | aKey asByteArray ] ifAbsent: [ ^ifNone value ].
     ^ selected first asString.

That way, one can know whether the item was missing, treating that condition as an error or ignoring it as appears to work in your case.  My images are littered with #asByteArray methods, which complicates spotting what that might be doing.  The change above (hopefully??) preserves the original behavior when the attribute is present; at least that was my goal.

From: pharo-project-bounces at lists.gforge.inria.fr [pharo-project-bounces at lists.gforge.inria.fr] On Behalf Of Olivier Auverlot [olivier.auverlot at gmail.com]
Sent: Wednesday, February 16, 2011 8:41 AM
To: Pharo-project at lists.gforge.inria.fr
Subject: [Pharo-project] Pharo & LDAP


For a project of REST services with Pharo and Seaside, I need to send
requests to an LDAP server. I found a project named LDAPlayer on

Now, I can create a connection and do a request to the LDAP server.

But... my problem is to read an attribute in the result. In the
LDAPSearchResultEntry object, the method to get a value is :

attrAt: aKey
     | selected |
     selected := attrs at: (aKey asByteArray) ifAbsent: [ ^ nil ].
     ^ selected first asString.

The problem seems to be on the third line with the use of the
asByteArray method. Why used this method ?

For my tests, I remplaced it with :

selected := attrs at: aKey ifAbsent: [ ^ nil ].

And now, it's ok but I don't know if my modification could introduce
others problems.

What do you think about that ? Someone has used LDAPlayer with Pharo ?

Best regards

Olivier ;-)


More information about the Pharo-project mailing list