Authorize demo

Description
This page displays the authorize component in a tml template.

Role definition can be controlled with any, all and not rules.
Have a look at the TML Source code to see what really happens !


In Action
Choose your role : Admin
User
Anonymous



Your current role is :

Content displayed according to role : If you see this, you have selected the role Anonymous or have no role (not User nor Admin).





TML Source code

		<!-- form -->
		<t:form>
			<fieldset>
				<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/>
		        </t:radiogroup>
		        <t:submit/>
	        </fieldset>
		</t:form>
		<br/><hr/><br/>
		
		Your current role is <b>${currentRole }</b> : <br/><br/>
		
		<fieldset>
			<legend>Content displayed according to role :</legend>
			<!-- Authorize display -->
			<ex:authorize any="ROLE_USER">
				If you see this, you are on role User.
			</ex:authorize>
			
			<ex:authorize any="ROLE_ADMIN">
				Hello Admin.
			</ex:authorize>
			
			<ex:authorize not="ROLE_USER,ROLE_ADMIN">
				If you see this, you have selected the role Anonymous or have no role (not User nor Admin).
			</ex:authorize>
			
			<ex:authorize all="ROLE_USER,ROLE_ADMIN">
				You can't see this :).
			</ex:authorize>
		</fieldset>
		<br/><br/>