Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting the mail group from LDAP

 
Shamu Somasundaram
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
In our application, Useers are authenticated from LDAP. LDAP will return me the user id of the logged in user after authentication. Infact I am using personppidx attribute to get the user id of the logged in person.
Now, If the logged in user belongs to some lotus mail group in LDAP, how will I get the mail group the user belongs to from my Java class.

My cosde for getting the user id goes like this.

NamingEnumeration enum = ctx.search("","uid="+userName,new SearchControls(SearchControls.SUBTREE_SCOPE,0,0,null,true,true));

while(enum.hasMoreElements())
{
Attributes attrs = ((SearchResult)enum.next()).getAttributes();
}
while(enum.hasMoreElements()){
Attributes attrs = ((SearchResult)enum.next()).getAttributes();
Attribute attr = attrs.get("personppidx");
if(attr != null)
ppidx = (String) attr.get(0);

if(ppidx == null){
enum = ctx.search("","cn="+userName,new SearchControls(SearchControls.SUBTREE_SCOPE,0,0,null,true,true));

while(enum.hasMoreElements()){
Attributes attrs = ((SearchResult)enum.next()).getAttributes();
if(attrs != null){
Attribute attr = attrs.get("personppidx");
if(attr != null)
ppidx = (String) attr.get(0);
}


}
}

so ppidx returns me the user id.
But I'm not finding any attributes giving me the details whether the user belongs to a mail group or not.
Please suggest me some ways to get the details of the mail gropu the person belongs to.

Thanks in advance.
Shanmugavel.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic