Source Code Cross Referenced for PermissionsHelperAction.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » authz » tool » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » sakai » org.sakaiproject.authz.tool 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL: https://source.sakaiproject.org/svn/authz/tags/sakai_2-4-1/authz-tool/tool/src/java/org/sakaiproject/authz/tool/PermissionsHelperAction.java $
003:         * $Id: PermissionsHelperAction.java 13672 2006-08-15 03:22:07Z ggolden@umich.edu $
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 2005, 2006 The Sakai Foundation.
007:         * 
008:         * Licensed under the Educational Community License, Version 1.0 (the "License"); 
009:         * you may not use this file except in compliance with the License. 
010:         * You may obtain a copy of the License at
011:         * 
012:         *      http://www.opensource.org/licenses/ecl1.php
013:         * 
014:         * Unless required by applicable law or agreed to in writing, software 
015:         * distributed under the License is distributed on an "AS IS" BASIS, 
016:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
017:         * See the License for the specific language governing permissions and 
018:         * limitations under the License.
019:         *
020:         **********************************************************************************/package org.sakaiproject.authz.tool;
021:
022:        import java.io.IOException;
023:
024:        import javax.servlet.http.HttpServletRequest;
025:        import javax.servlet.http.HttpServletResponse;
026:
027:        import org.sakaiproject.authz.api.PermissionsHelper;
028:        import org.sakaiproject.cheftool.Context;
029:        import org.sakaiproject.cheftool.RunData;
030:        import org.sakaiproject.cheftool.VelocityPortlet;
031:        import org.sakaiproject.cheftool.VelocityPortletPaneledAction;
032:        import org.sakaiproject.event.api.SessionState;
033:        import org.sakaiproject.util.ResourceLoader;
034:        import org.sakaiproject.tool.api.Tool;
035:        import org.sakaiproject.tool.api.ToolException;
036:        import org.sakaiproject.tool.api.ToolSession;
037:        import org.sakaiproject.tool.cover.SessionManager;
038:        import org.sakaiproject.tool.cover.ToolManager;
039:
040:        /**
041:         * This is a helper interface to the Permissions tool.
042:         */
043:        public class PermissionsHelperAction extends
044:                VelocityPortletPaneledAction {
045:            private static ResourceLoader rb = new ResourceLoader("authz-tool");
046:
047:            private static final String STARTED = "sakaiproject.permissions.started";
048:
049:            protected void toolModeDispatch(String methodBase,
050:                    String methodExt, HttpServletRequest req,
051:                    HttpServletResponse res) throws ToolException {
052:                SessionState sstate = getState(req);
053:                ToolSession toolSession = SessionManager
054:                        .getCurrentToolSession();
055:
056:                String mode = (String) sstate
057:                        .getAttribute(PermissionsAction.STATE_MODE);
058:                Object started = toolSession.getAttribute(STARTED);
059:
060:                if (mode == null && started != null) {
061:                    toolSession.removeAttribute(STARTED);
062:                    Tool tool = ToolManager.getCurrentTool();
063:
064:                    String url = (String) SessionManager
065:                            .getCurrentToolSession().getAttribute(
066:                                    tool.getId() + Tool.HELPER_DONE_URL);
067:
068:                    SessionManager.getCurrentToolSession().removeAttribute(
069:                            tool.getId() + Tool.HELPER_DONE_URL);
070:
071:                    try {
072:                        res.sendRedirect(url);
073:                    } catch (IOException e) {
074:                        Log.warn("chef", this  + " : ", e);
075:                    }
076:                    return;
077:                }
078:
079:                super .toolModeDispatch(methodBase, methodExt, req, res);
080:            }
081:
082:            /**
083:             * Allow extension classes to control which build method gets called for this pannel
084:             * @param panel
085:             * @return
086:             */
087:            protected String panelMethodName(String panel) {
088:                // we are always calling buildMainPanelContext
089:                return "buildMainPanelContext";
090:            }
091:
092:            /**
093:             * Default is to use when Portal starts up
094:             */
095:            public String buildMainPanelContext(VelocityPortlet portlet,
096:                    Context context, RunData rundata, SessionState sstate) {
097:                String mode = (String) sstate
098:                        .getAttribute(PermissionsAction.STATE_MODE);
099:
100:                if (mode == null) {
101:                    initHelper(portlet, context, rundata, sstate);
102:                }
103:
104:                String template = PermissionsAction.buildHelperContext(portlet,
105:                        context, rundata, sstate);
106:                if (template == null) {
107:                    addAlert(sstate, rb.getString("java.alert.prbset"));
108:                } else {
109:                    return template;
110:                }
111:
112:                return null;
113:            }
114:
115:            protected void initHelper(VelocityPortlet portlet, Context context,
116:                    RunData rundata, SessionState state) {
117:                ToolSession toolSession = SessionManager
118:                        .getCurrentToolSession();
119:
120:                String prefix = (String) toolSession
121:                        .getAttribute(PermissionsHelper.PREFIX);
122:                String targetRef = (String) toolSession
123:                        .getAttribute(PermissionsHelper.TARGET_REF);
124:                String description = (String) toolSession
125:                        .getAttribute(PermissionsHelper.DESCRIPTION);
126:                String rolesRef = (String) toolSession
127:                        .getAttribute(PermissionsHelper.ROLES_REF);
128:                if (rolesRef == null)
129:                    rolesRef = targetRef;
130:
131:                toolSession.setAttribute(STARTED, new Boolean(true));
132:
133:                // setup for editing the permissions of the site for this tool, using the roles of this site, too
134:                state.setAttribute(PermissionsAction.STATE_REALM_ID, targetRef);
135:
136:                // use the roles from this ref's AuthzGroup
137:                state.setAttribute(PermissionsAction.STATE_REALM_ROLES_ID,
138:                        rolesRef);
139:
140:                // ... with this description
141:                state.setAttribute(PermissionsAction.STATE_DESCRIPTION,
142:                        description);
143:
144:                // ... showing only locks that are prpefixed with this
145:                state.setAttribute(PermissionsAction.STATE_PREFIX, prefix);
146:
147:                // start the helper
148:                state.setAttribute(PermissionsAction.STATE_MODE,
149:                        PermissionsAction.MODE_MAIN);
150:            }
151:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.