0

I am trying to query one ldap group using Python ldap3 library. But the result of the search is only giving users who are active. I want to get all the users even the inactive users also. I am not able to find what should I include in the search filter:

"(&(memberOf=CN=group1,OU=SomeOU2,OU=Groups,OU=Users,ou=SomeOU1,dc=vds,dc=enterprise))"

Below is the code :

tlsConfiguration = ldap3.Tls(validate=ssl.CERT_REQUIRED, version=ssl.PROTOCOL_TLSv1)
        
ldapServer = ldap3.Server("vds-host.sanofi.com", 636, use_ssl=True, get_info=ldap3.ALL)
    
ldapCon = ldap3.Connection(ldapServer, "USER", "PWD", auto_bind=True)

ldapCon.search(search_base = "dc=vds,dc=enterprise",
            search_filter = "(&(memberOf=CN=group1,OU=SomeOU2,OU=Groups,OU=Users,ou=SomeOU1,dc=vds,dc=enterprise))", 
            search_scope = ldap3.SUBTREE, 
            attributes = ldap3.ALL_ATTRIBUTES
            )
  • Which directory server are you using (Active Directory, OpenLDAP, etc)? And are you sure you actually have inactive users in that group? – Gabriel Luci Aug 24 '23 at 17:10

0 Answers0