Authorize mixin demo

Description
This page displays the authorize mixin in a tml template. This allows you to apply the authorizations on any existing tml element.

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>
			
			<t:pagelink 
				page="Index"
				t:mixins="exanpe/AuthorizeMixin"
				t:any="ROLE_USER,ROLE_ADMIN">
					This link is displayed for User or Admin
			</t:pagelink><br/><hr/><br/>
			
			<t:pagelink 
				page="Index"
				t:mixins="exanpe/AuthorizeMixin"
				t:any="ROLE_USER">
					This link is displayed for User only
			</t:pagelink><br/><hr/><br/>
			
			<t:any 
				t:mixins="exanpe/AuthorizeMixin"
				t:not="ROLE_USER, ROLE_ADMIN">
				If you see this, you have selected the role Anonymous or have no role (not User nor Admin).
			</t:any>
		</fieldset>
		<br/><br/>