ViewHelper Documentation
security.ifHasRole
This view helper implements an ifHasRole/else condition.
= Examples =
<f:security.ifHasRole role="Administrator">
This is being shown in case you have the Administrator role (aka role) defined in the
current package according to the controllerContext
</f:security.ifHasRole>
<f:security.ifHasRole role="Administrator" packageKey="Acme.MyPackage">
This is being shown in case you have the Acme.MyPackage:Administrator role (aka role).
</f:security.ifHasRole>
<f:security.ifHasRole role="Acme.MyPackage:Administrator">
This is being shown in case you have the Acme.MyPackage:Administrator role (aka role).
</f:security.ifHasRole>
Everything inside the <f:ifHasRole> tag is being displayed if you have the given role.
<f:security.ifHasRole role="Administrator">
<f:then>
This is being shown in case you have the role.
</f:then> <f:else>
This is being displayed in case you do not have the role.
</f:else> </f:security.ifHasRole>
Everything inside the "then" tag is displayed if you have the role. Otherwise, everything inside the "else"-tag is displayed.
<f:security.ifHasRole role="{someRoleObject}">
This is being shown in case you have the specified role
</f:security.ifHasRole>
<f:security.ifHasRole role="Administrator" account="{otherAccount}">
This is being shown in case "otherAccount" has the Acme.MyPackage:Administrator role (aka role).
</f:security.ifHasRole>
Arguments
then anySimpleType
Value to be returned if the condition if met.
else anySimpleType
Value to be returned if the condition if not met.
condition boolean
Condition expression conforming to Fluid boolean rules
role anySimpleType
The role or role identifier.
packageKey string
PackageKey of the package defining the role.
account anySimpleType
If specified, this subject of this check is the given Account instead of the currently authenticated account