I have a little bit knowledge of LDAP. I have organozational structure in LDAP in below format,
uid=test.gen,OU=Generics,O=cco.mycomp.com
Above uid is part of group "EF_GROUP" and some other groups also.
Now i am only getting leaf note value in my method that is "test.ge开发者_如何学运维n".
So my problem is that i want retrieve the all groups in which given uid is being belonging.
Please help me out.
An LDAP query of
(&(objectClass=group)(memberof=YourUsersDNhere))
would find them. You should be allowed to specify a base DN that is where the groups ought to be located. Which is nice as it also would scope the query a bit.
However, you will not have a memberUid attribute on the group in ADAM as you might in OpenLdap or the like, which would be an even easier search. Though of course, you could maintain it and use that instead. (MemberUid is usually just the shortname of the user vs the full DN that is usually in member).
ldapsearch -xb 'dc=example,dc=com' '(&(cn=*)(memberUid=USER))'
where USER is the uid that you want to know about
Depending on which directory server hosts your data, you could request the memberOf
or isMemberOf
attribute in your LDAP search request to determine to which groups a user belongs. The blog entry "Using the groupOfUrls object class" has an example of this type of search.
精彩评论