I am trying to set up the filter to retrieve all the groups that are a member of a particular user. I'm using Python, currently try
Import Traceback ldap: l = ldap.open ("192.168.1.1"). . . L.simple_bind_s (username, password) ######################################### ################# f_filterStr = '(objectclass = group)' # Want to modify it, so I have not created the next loop ... #### ################################################## ################# # The next command takes some seconds results = l.search_s (dn_recs, ldap.SCOPE_SUBTREE, f_filterStr) In the results I: if dict == type (i [ 1]): group_name = i [1] .get ('name') if list == type (group_name): group_name = group_name [0]; Search_str = "CN =% s,"% username_bare if -1! = ("% S"% i [1] .get ('member')). Find (search_str): Print "Users are related to this group!% S"% Group_name Except exception, E: # as you handle
I think you are making this very difficult.
There is no dragon expert, but you can easily query Microsoft Active Directory by using a filter like this:
(member: 1.2.840.113556 .1.4.1941: = (CN = Username, CN = User, DC = UARDNA, DC = Net))
-Jim
Comments
Post a Comment