I am writing a JSP which needs to display the user role of the user logged into the portal server.
For this i am making use of the profile object which i retrive from the session.
SessionID sid = new SessionID(request);
Session sess = Session.getSession(sid);
Profile prof = sess.getUserProfile();
String x = prof.getAttributeString("iwtUserInfoProvider-firstName");
out.println("Portal Server User First Name: " + x + "<BR>");
String y = prof.getAttributeString("iwtUser-role");
out.println("Portal Server User Role : " + y + "<BR>");
However i am hitting a problem here. I am able to retrive the user role only on occasions when the admin users are logging in. In the case when the normal user is loggin in the JSP is throwing the following error while trying to access the user role.
"An error occured! com.iplanet.portalserver.profile.ProfileException: Permission denied in getting attributes or privileges."
What do i have to do to retrive the user role from the profile server ? Is the profile accessible to only admin users ?
Any suggestion or help is welcome.
Thanks in advance
I found the answer, you need to go to the admin console> domain>role
click on the User link then click on the radio button for Show Read/Write permissions. Give read access for the User role attribute and apply it to all roles and sub roles.