开发者

retrieving multi-valued DN attributes using ActiveLdap

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?


i just ran into this a couple weeks ago: 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜