Getting User Information in a Velocity Template

It is sometimes usefull to conditionally display formatting, debug information, or content when previewing Percussion templates.  Percussion user information is only available during Preview or Edit contexts as the current user when publishing is running will always be the systems internal rxserver user. 

Return the Current User

$rx.asmhelper.getUserName()

 

Get the Roles for the Current User

$rx.asmhelper.getUserRoles()

Example

<h2>User Name: $rx.asmhelper.getUserName()</h2>

<h2>Roles:</h2>

#foreach($role in $rx.asmhelper.getUserRoles())

<h3>$role</h3>

#if($role == "Admin")

Place some Admin specific code / content here.

#end##