Authorize demo

This page displays the authorize component in a tml template, with specific role content externalized inside blocks.
Notice the blockId parameter.

In Action
Choose your role : Admin

Your current role is :

Content displayed according to role :

TML Source code

		<!-- form -->
				<legend>Choose your role :</legend>
				<t:radiogroup t:id="role" t:value="role">
		            <t:radio t:value="literal:ADMIN"/> Admin<br/>
		            <t:radio t:value="literal:USER"/> User<br/>
		            <t:radio t:value="literal:ANONYMOUS"/> Anonymous<br/>
		Your current role is <b>${currentRole }</b> : <br/><br/>
			<legend>Content displayed according to role :</legend>
			<!-- Authorize display -->
			<ex:authorize any="ROLE_USER" block="userBlockAction"/>
			<ex:authorize any="ROLE_ADMIN" block="adminBlockAction"/>
			<t:block id="userBlockAction">
				If you see this block, you are on role User.<br/><br/>
			<t:block id="adminBlockAction">
				If you see this block, you are on role Admin !

Java code

		public class Example2 extends BaseAuthorize
		    private Block userBlockAction;
		    private Block adminBlockAction;