title: Use ldap3 to query all active directory groups a user belongs to
body: <p>I have no problem to query the domain user from active directory with this query</p>
  
  <pre><code>from ldap3 import ObjectDef, AttrDef, Reader, Entry, Attribute, OperationalAttribute
  import ldap3
  
  person = ObjectDef('inetOrgPerson')
  s = ldap3.Server('myad.com')
  c = ldap3.Connection(s, user = 'myuser', password = 'mypassword')
  
  ldap3.Reader(c, person, '(&amp;(objectCategory=person)(sAMAccountName=myuser))', 'dc=mydomain,dc=com').search()
  </code></pre>
  
  <p>however, this query returns empty list of groups the user belongs to, how to make it work?</p>
  
  <pre><code>ldap3.Reader(c, person, '(&amp;(objectCategory=group)(member=myuser))', 'dc=mydomain,dc=com').search()
  </code></pre>
  
  <p>I use <a href="https://ldap3.readthedocs.org/en/latest/abstraction.html#overview" rel="nofollow">ldap3</a>. Thanks in advance.</p>