Sunday 17 November 2013

Reading Portal Page's Unique Name in Theme 8

To get the name of a unique page in portal's dynamic contents such as navigation.jsp, use the following code.
${node.objectID.uniqueName}

Tuesday 29 October 2013

Accessing User Credentials in Portal 8 Theme


It is possible to access the logged in user credentials in Portal 8 theme in any of the dynamic jsp (such as navigation.jsp, commonActions.jsp etc.,

The following are the required attributes needed to access the credentials.

1. Email  - ${wp.user['mail']} or ${wp.user['ibm-primaryEmail']}
2. Name - ${wp.user['givenName']}
3. Surname - ${wp.user['sn']}
4. Group - ${wp.user['cn']}

For more information Click Here

Sunday 27 October 2013

Checking whether a Portal Page has Page Parameters set

In order to check whether a Portal Page has page parameters use the following...

<c:set var="some_variable" value="${node.metadata['key']}"></c:set>


Accessing Page Parameters from Portal Themes

It is possible to access Page Parameters from Portal Theme using 
<portal-logic:pageMetaData> tag 

<portal-logic:pageMetaData varname="pageMetaData">
     <c:forEach var="metaItem" items="${pageMetaData}">
       ${metaItem.key}              <!-- Gives Page Parameter Key -->
       ${metaItem.value}            <!-- Gives Page Parameter Value -->
     </c:forEach>
</portal-logic:pageMetaData>

Portal 8 Theme - Checking Logged in User Role Type

To check whether logged in user belong to admin group check the following in your Theme's any of the dynamic jsp (eg: navigation.jsp, footer.jsp and so on)

<c:set var="admin" value="<%=com.ibm.portal.ac.data.RoleType.ADMIN%>"/>
<c:if test="${wp.ac[wp.selectionModel.selected].hasPermission[admin]}">
//if admin
</c:if>



Role Types

The com.ibm.portal.ac.data.RoleType object shown above exposes the following RoleType constants:

ADMIN
SECURITY_ADMIN
DELEGATOR
CAN_RUN_AS_USER
MANAGER
EDITOR
MARKUP_EDITOR
CONTRIBUTOR
PRIVILEGED_USER
USER


For more information Click Here