KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jmanage > webui > actions > auth > ShowAddUserAction


1 /**
2  * Copyright 2004-2005 jManage.org
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.jmanage.webui.actions.auth;
18
19 import org.jmanage.webui.actions.BaseAction;
20 import org.jmanage.webui.util.WebContext;
21 import org.jmanage.webui.util.RequestAttributes;
22 import org.jmanage.webui.util.Forwards;
23 import org.jmanage.core.auth.RoleManager;
24 import org.jmanage.core.services.AccessController;
25 import org.apache.struts.action.ActionForward;
26 import org.apache.struts.action.ActionMapping;
27 import org.apache.struts.action.ActionForm;
28
29 import javax.servlet.http.HttpServletRequest JavaDoc;
30 import javax.servlet.http.HttpServletResponse JavaDoc;
31 import java.util.List JavaDoc;
32
33 /**
34  * Show addUser JSP with configured roles populated.
35  *
36  * Date: Mar 20, 2005 9:06:20 PM
37  * @author Shashank Bellary
38  */

39 public class ShowAddUserAction extends BaseAction{
40
41     /**
42      * Get all configured roles from the configuration file and send it for
43      * per-population.
44      *
45      * @param context
46      * @param mapping
47      * @param actionForm
48      * @param request
49      * @param response
50      * @return
51      * @throws Exception
52      */

53     public ActionForward execute(WebContext context,
54                                  ActionMapping mapping,
55                                  ActionForm actionForm,
56                                  HttpServletRequest JavaDoc request,
57                                  HttpServletResponse JavaDoc response)
58             throws Exception JavaDoc {
59         AccessController.checkAccess(context.getServiceContext(), ACL_ADD_USERS);
60
61         List JavaDoc roles = RoleManager.getAll();
62         request.setAttribute(RequestAttributes.ROLES, roles);
63         return mapping.findForward(Forwards.SUCCESS);
64     }
65 }
66
Popular Tags