title: How to get users of group (with nested) in OpenLDAP (UnboundID Java API)
body: <p>H everyone,</p>
  <p>I am having a problem with getting all the users that are inside of one group. I have the group name, and my task is to get list of all users. I do not have enabled <strong>memberOf</strong> property in OpenLDAP server. So far I was able to get the group using:</p>
  <pre><code> &quot;(&amp;(objectClass=groupOfNames)(cn=&quot; + groupName + &quot;))&quot;;
  </code></pre>
  <p>When I got this, I used the attribute <strong>member</strong> of found group e.g &quot;cn=ldapuser1,ou=Users,dc=example,dc=com&quot;</p>
  <p>Then having this I did another query to get all users with given name (in the example above the name would be ldapuser1). I user this query:</p>
  <pre><code>&quot;(&amp;(objectClass=inetOrgPerson)(|&quot; + builder + &quot;))&quot;; // it can contain several names
  </code></pre>
  <p>Problem is that if my main group contain another group... my second query would not work.</p>
  <p>So what works for now is: (but is not that straightforward and easy) getting users of one single group (2 calls to the server are required - first to get group, and then based on member attribute I do second query that asks for specific users)</p>
  <p>What does not work is e.g if one single group contain one user and one group that e.g. contains 2 users, in the final result with my current solution I got only one user. What I want is to have three users as a result in this example.</p>
  <p>I have already working Active Directory user search and it is so simple - I use just memberOf with  &quot;1.2.840.113556.1.4.1941&quot; filter for nested groups and their users. Why it can not be this simple with OpenLDAP?</p>
  <p>So my final question is what is the best approach to implement this, how to build this kind of query ?</p>
  <p>I would really like some advice from you guys,</p>
  <p>any help would be appreciated!</p>
  <p>many thanks,</p>
  <p>cheers</p>