title: LDAP Check for person existence in a top level Organization
body: <p>I am a starter in LDAP and just learnt in last few days about how to make LDAP queries. I 
  used this fragment of code to find the membership of a person in a group.</p>
  
  <pre><code>    SearchControls srch = new SearchControls();
      srch.setSearchScope(SearchControls.SUBTREE_SCOPE); 
      String search_start = "CN=somegroup@myworld.com,OU=Managed Groups,OU=Accounts,DC=americas,DC=myworld,DC=com";
      String[] attrIDs = {"cn"};
      srch.setReturningAttributes(attrIDs);
      String search_target = "(member=CN=django@myworld.com,OU=US,OU=Users,OU=Accounts,DC=americas,DC=myworld,DC=com)";
      NamingEnumeration answer = cntxt.search( search_start, search_target,srch );
      boolean isInGroup = false;
      while(answer.hasMore()) {
          SearchResult rslt = (SearchResult)answer.next();
          Attributes attrs = rslt.getAttributes();
          NamingEnumeration&lt;String&gt; all = attrs.getIDs();
          isInGroup = true;
              break; 
      }
  </code></pre>
  
  <p>My task now if to also find if the person belongs to a organization at the top level. I am out of ideas to figure what kind of query can I use in such a case. Can someone provide some advice on this?  </p>
  
  <p>regards,
  koya</p>