Wednesday, January 21, 2009

Consuming uPortal User Attributes as JSR-168 User Attributes

You need to add to your portlet.xml something like


User Family Name
user.name.family


where the attribute is the Key mapped within your PersonDirectory.xml or personDirs.xml (see manual chapter on user attributes).

Then from within your Portlet code you can access the values like this


Map userInfo = (Map)request.getAttribute(PortletRequest.USER_INFO);
String surname = (String)userInfo.get("user.name.family");