Satya P
Satya P

Reputation: 1067

How to search or find whether a user is a member of a group or not using LDAP query?

I have a LDAP hierarchy base like dc=domain,dc=myCompany,dc=com. It has two organizational units like Groups and People. I have two groups like group1 and group2.

How can I find whether a user/member with the given distinguished name(dn) is a member of a group or not?

Upvotes: 0

Views: 291

Answers (1)

jwilleke
jwilleke

Reputation: 11046

Query with a base=cn=group1,ou=groups,dc=yourdomain,dc=com and a filter like:

(member=cn=username,dc=yourdomain,dc=com) 

should get you started.

For checking if the user could also be a member of the group from other nested groups, use a filter like:

(member:1.2.840.113556.1.4.1941:=(CN=UserName,CN=Users,dc=yourdomain,dc=com))

-jim

Upvotes: 1

Related Questions