KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > component > RoleExprTag


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 package com.tonbeller.wcf.component;
14
15 import javax.servlet.jsp.JspTagException JavaDoc;
16 import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
17
18 import com.tonbeller.wcf.controller.RequestContext;
19
20 /**
21  * A conditional tag that evaluates its body if the roleExpr is successful
22  * @author av
23  */

24 public class RoleExprTag extends ConditionalTagSupport {
25   String JavaDoc role;
26   
27   protected boolean condition() throws JspTagException JavaDoc {
28     RequestContext context = RequestContext.instance();
29     return context.isUserInRole(role);
30   }
31
32   public void setRole(String JavaDoc string) {
33     role = string;
34   }
35
36 }
37
Popular Tags