tags:

views:

15

answers:

1

Some users in my LDAP Directory have several uids assigned as such:

dn: uid=user1,ou=People,o=org
uid: user1
uid: nick1

dn: uid=user2,ou=People,o=org
uid: user2
uid: nick2

While trying to get uid for these users using ActiveLdap (like User.uid) I only get the first uid attr as it is DN attribute.

Is it possible with ActiveLdap to get both of them?

A: 

i just ran into this a couple weeks ago: http://stackoverflow.com/questions/3188950/query-all-the-users-in-a-system-with-ldap

It is not an ActiveLDAP issue per say.

Here is the thing, and I will hopefully save you some time. with your ldap schema, as is, what you have is a unique dn for every user. So, in effect, if you have 100,000 users, you have 100,000 folders, each identified at the top level as unique by id. if your schema was setup like this:

dn: category=active,ou=People,o=org
  uid: uid1
  uid: nick1

then you could query all the active users for overlapping uid because the filter would filter down to active users and select from that the users with uid attributes of x.

As it is, you can only get at the top level dn, so each filter will filter one user, so its useless. What I did is actually query my flatfile backup of the ldap database and extracted information that way. i used basic ruby and just split records on newlines, and made a big array, if I remember correctly. We had about 130,000 records and was able to get my query in about 2 seconds from the flat file.

Jed Schneider
No, I have the small database here (~900 LDAP entries) and Ruby-LDAP returns the right results, so it is issue with ActiveLdap only. It seems to strip the RDN attribute from attributes array leaving only one value (which is taken from DN) so I wonder if there is the way of stopping ActiveLdap doing this.
erthad