title: how to get groups of a user in ldap by members with attribute value
body: <p>My question is very similar to <a href="https://stackoverflow.com/questions/51341936/how-to-get-groups-of-a-user-in-ldap">how to get groups of a user in ldap</a> but I want to be able to search a group whose member has attribute foo with value bar</p>
  
  <p>ie, from the previous question instead of doing <code>(&amp;(objectClass=groupOfNames)(member=cn=root,ou=django,dc=openldap))</code></p>
  
  <p>I want to do something like 
  <code>(&amp;(objectClass=groupOfNames)(member=sn=bar))</code>
  but it seems only the full DN can be used for such query. Is there another way to find groups for user matching a pattern?</p>