ATG Portal includes several methods that check for user roles.
isPortalAdministrator Method
The Portal.isPortalAdministrator
method tests to see if the user has a Portal Administrator role. If the user is logged in and is a Portal Administrator, then the method returns a value of true and the body of the tag is evaluated. If the user is not logged in, or is not a Portal Administrator, the method returns a value of false and the body of the tag is skipped. For example:
<core:if value="<%= gearEnv.isPortalAdministrator() %>"> Your content here </core:if>
hasRole Methods
The Community.hasRole
and Gear.hasRole
methods test to see if the user has a specified role in the current community or gear. If the user is logged in and has the appropriate role, then the method returns a value of true and the body of the tag is evaluated. If the user is not logged in, or does not have the appropriate role, the method returns a value of false and the body of the tag is skipped.