I am using Net::LDAP in ruby to get person entity information like cn,department but I also want the list groups of which the user is member of , I tried using memberof attribute but it returns only one group example given below, but I am memver of multiple groups
{:cn=>"Garg, Puja",
:title=>"Developer",
:mail=>"[email protected]",
:samaccountname=>"pujagarg",
:memberof=>"CN=DEVELOPER TEAM,OU=Distribution Groups,OU=_Global,OU=ABC,DC=int,DC=abc,DC=com"}
Solution 1:memberOf (in AD) is stored as a list of distinguishedNames. Your filter needs to be something like:
If you don't yet have the distinguished name, you can search for it with:
Example:
This example list the all the groups the user is part of.
More details refer this thread
Solution 2: Example using a modern ldapsearch command line tool:
This search response indicated that user.0 is a member of the listed groups. The above is a general explanation of one way to deal with group membership from an LDAP perspective.
Also refer this link for more details.