Show TOC Start of Content Area

Background documentation User Information  Locate the document in its SAP Library structure

Portlets can provide personalized content to the requesting user. To do this, they may require access to user attributes. The portlet container provides a mechanism to expose available user information to portlets. The deployment descriptor of a portlet application defines the user attribute names the portlets will use:

Example

<portlet-app>

<user-attribute>

<description>User Given Name</description>

<name>user.name.given</name>

</user-attribute>

<user-attribute>

<description>User Last Name</description>

<name>user.name.family</name>

</user-attribute>

<user-attribute>

<description>User eMail</description>

<name>user.home-info.online.email</name>

</user-attribute>

<user-attribute>

<description>User Job Title</description>

<name> user.jobtitle</name>

</user-attribute>

<user-attribute>

<description>User Department</description>

<name>user.department</name>

</user-attribute>

<user-attribute>

<description>User Telephone Number</description>

<name>user.home-info.telecom.telephone.number</name>

</user-attribute>

<user-attribute>

<description>User Cell phone Number</description>

<name>user.home-info.telecom.mobile.number</name>

</user-attribute>

<user-attribute>

<description>User Fax</description>

<name>user.home-info.telecom.fax.number</name>

</user-attribute>

<portlet-app>

Currently, the portlet container can expose the following user attributes only: user first name, user last name, email, job title, department, telephone number, mobile telephone number, and fax. The exact names shown above should be used. Portlets do not have access to user passwords. The portlet accesses the available user attributes with the following code:

Example

String givenName = “”;

 

Map userInfo = (Map)request.getAttribute(PortletRequest.USER_INFO);

if(userInfo != null) {

givenName = (String) userInfo.get("user.name.given");
lastName = (String) userInfo.get("user.name.family");
jobTitle = (String) userInfo.get("user.jobtitle");
department = (String) userInfo.get("user.department");
phone = (String) userInfo.get("user.home-info.telecom.telephone.number");

cellPhone = (String) userInfo.get("user.home-info.telecom.mobile.number");
email = (String) userInfo.get("user.home-info.online.email");
fax = (String) userInfo.get("user.home-info.telecom.fax.number");

}

Note

User attributes of the runtime environment not declared in the deployment descriptor will not be exposed to portlets. User attributes that are declared in the descriptor, but are not available at run time, will not be exposed either.

 

 

 

 

End of Content Area