[Seaside] Re: Fwd: Access username using Ldap

Andreas Raab andreas.raab at gmx.de
Fri Apr 9 16:21:52 UTC 2010


On 4/9/2010 1:50 AM, harji gill wrote:
> I am using
>
> conn := LDAPConnection to: 'hostname' port: 389.
>
> I am able to connect using this but I don't know what attributes I need
> to use to get the list of all the users.

First you need to bind, i.e.,

req := conn bindAs: bindDN credentials: password.
req waitTimeoutSeconds: 5.
req isDone ifFalse:[self error: 'LDAP bind failure'].

Then you search for the right object class and attributes:

req := conn newSearch: baseDN
	scope: LDAPConnection wholeSubtree
	deref: LDAPConnection derefNever
	filter: (LDAPFilter with: 'objectclass' equalTo: 'person'}
	attrs: #('*' '+')
	wantAttrsOnly: false.

[result := req next] whileNotNil:[
	Transcript cr; show: (result attrs at: 'cn')
].


Cheers,
   - Andreas

> ---------- Forwarded message ----------
> From: *harji gill* <harji.gill at gmail.com <mailto:harji.gill at gmail.com>>
> Date: Fri, Apr 9, 2010 at 9:41 AM
> Subject: Access username using Ldap
> To: seaside at lists.squeakfoundation.org
> <mailto:seaside at lists.squeakfoundation.org>
>
>
> Hi All,
>
> Does anyone know how I can get usernames using LDAP
>
> Thanks
>
>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list