1 /***
2 * The contents of this file are subject to the Mozilla Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/MPL/
6 *
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
11 *
12 * The Original Code is pow2ACL library.
13 *
14 * The Initial Owner of the Original Code is Power Of Two S.R.L.
15 * Portions created by Power Of Two S.R.L. are Copyright (C) Power Of Two S.R.L.
16 * All Rights Reserved.
17 *
18 * Contributor(s):
19 */
20
21 package com.pow2.acl.taglib;
22
23 import com.pow2.acl.Group;
24 import com.pow2.acl.dao.ACLDAO;
25 import com.pow2.user.User;
26 import javax.servlet.http.HttpServletResponse;
27
28 import javax.servlet.http.HttpSession;
29
30 import javax.servlet.jsp.*;
31 import javax.servlet.jsp.tagext.*;
32
33 /***
34 * @author Massimiliano Farnea
35 */
36 public class IsUserInGroupTag extends ACLTag
37 {
38 /***
39 * Default constructor
40 */
41 public IsUserInGroupTag()
42 {
43 super();
44 }
45
46
47 /***
48 * Process the start tag for this instance.
49 * Eval body if User is in Group
50 *
51 * @return Description of the Returned Value
52 * @exception JspTagException if an error occures.
53 */
54 public int doStartTag() throws JspTagException
55 {
56 try
57 {
58 userAuthenticated = acldao.isUserInGroup(getUser(), new Group(group));
59 }
60 catch (Exception e)
61 {
62 cat.error("::doStartTag - exception: ", e);
63 throw new JspTagException("Error: " + e.getMessage());
64 }
65
66 return booleanValue(userAuthenticated) ? EVAL_BODY_INCLUDE : SKIP_BODY;
67 }
68 }
This page was automatically generated by Maven