WebSphere Portal PUMA API

The details of our WebSphere Portal users are stored in IBM Tivoli LDAP server. This code prints what attributes of users are actually available and enables us to show them in a theme JSP. So our JSR 168 portlets have to further rely on IBM-specific code. Portability is really a lost cause.

try{

     javax.naming.Context ctx = new javax.naming.InitialContext();
     com.ibm.portal.um.PumaHome home = (com.ibm.portal.um.PumaHome)
     ctx.lookup("portal:service/usermanagement/Puma");
     PumaProfile profile = home.getProfile( request );
     List attributes = profile.getDefinedUserAttributeNames();
     User user = profile.getCurrentUser();
     Map map = profile.getAttributes(user, attributes);
     Iterator iterator = attributes.iterator();

      while (iterator.hasNext()) {
        String attribute = (String)iterator.next();
        System.out.println("["+ attribute +"][" +
                                  map.get(attribute) + "]");
     }

}catch( PumaSystemException pse ){
     System.out.println( "PumaSystemException" );
}catch( PumaModelException pme ){
     System.out.println( "PumaModelException" );
}catch( PumaMissingAccessRightsException pmare ){
     System.out.println( "PumaMissingAccessRightsException" );
}catch( Exception e ){
     System.out.println( "Exception" );
}

One Response to WebSphere Portal PUMA API

  1. sambaMurthy says:

    Thanx for providing code.By this we can easily get user attributes from ldap.

    please kindly send a code to my mail id for creating users in LDAP.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: