AquaLogic User Interaction Development Guide

     Previous Next  Open TOC in new window   View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Securing Content Based on User Permissions Using Adaptive Tags

To insert content on a page based on conditional statements of user and group membership, use the pt:standard.choose, pt:standard.when and pt:standard.otherwise tags.

The pt:standard.choose tag denotes the start of a secured content section. The pt:standard.when tag includes a test condition (pt:test) that defines who has access to the enclosed content. The pt:standard.otherwise tag includes content that should be displayed by default.
Note: In ALI 6.1 and earlier, these tags are implemented as pt:choose, pt:when and pt:otherwise. This syntax is still supported.
The value for the pt:test attribute is case-sensitive. Multiple users or groups should be separated by commas, with semicolons separating user values from group values. The syntax is as follows:
<pt:standard.choose xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'>
<pt:standard.when pt:test="stringToACLGroup('user=userid1,userid2,...;group=groupid1,groupid2,groupid3;').isMember($currentuser) xmlns:pt='http://www.Plumtree.com/xmlschemas/ptui/'>
... content ...
</pt:standard.when>
<pt:standard.otherwise xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'>
... default content ...
</pt:standard.otherwise>
</pt:standard.choose>
For example:
<pt:standard.choose xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'>
<pt:when pt:test="stringToACLGroup('user=1;').isMember($currentuser)" xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'>
<title>welcome administrator</title></head>
... secret administrator content ...
</pt:standard.when>
<pt:standard.when pt:test="stringToACLGroup('user=200,201;group=200;').isMember($currentuser)"
xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'>
 <title>the 200 club</title></head>
... content only group 200 or users 200 and 201 can see ...
</pt:standard.when>
<pt:standard.otherwise xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'>
<title>everyone else</title></head>
... content any user can see ... 
</pt:standard.otherwise>
</pt:standard.choose>
You can also test if the current user is a guest user (not logged in). Since there can be multiple guest users in the portal, simply testing for default guest user ID 2 does not work.
<pt:standard.choose>
  <pt:standard.when pt:test="isGuest($currentuser)">
  ... guest user content ...
  </pt:standard.when> 
  <pt:standard.otherwise> 
  ... logged in user content ...
  </pt:standard.otherwise> 
</pt:standard.choose>

  Back to Top      Previous Next