KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > services > security > nosecurity > NoSecurityAccessController


1 /*
2  * Copyright 2000-2001,2004 The Apache Software Foundation.
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.apache.jetspeed.services.security.nosecurity;
18
19 // Java imports
20
import javax.servlet.ServletConfig JavaDoc;
21
22 // Jetspeed import
23
import org.apache.jetspeed.om.profile.Entry;
24 import org.apache.jetspeed.om.security.JetspeedUser;
25 import org.apache.jetspeed.portal.Portlet;
26 import org.apache.jetspeed.services.security.PortalAccessController;
27 import org.apache.jetspeed.services.security.PortalResource;
28
29 // Turbine imports
30
import org.apache.turbine.services.TurbineBaseService;
31 import org.apache.turbine.services.InitializationException;
32
33 /**
34  * NoSecurityAccessController
35  *
36  * Use this service if you want to disable all authorization checks
37  *
38  * @author <a HREF="taylor@apache.org">David Sean Taylor</a>
39  * @version $Id: NoSecurityAccessController.java,v 1.5 2004/02/23 03:53:24 jford Exp $
40  */

41 public class NoSecurityAccessController extends TurbineBaseService
42                                      implements PortalAccessController
43 {
44     
45     /**
46      * Given a <code>JetspeedUser</code>, authorize that user to perform the secured action on
47      * the given <code>Portlet</code> resource. If the user does not have
48      * sufficient privilege to perform the action on the resource, the check returns false,
49      * otherwise when sufficient privilege is present, checkPermission returns true.
50      *
51      * @param user the user to be checked.
52      * @param portlet the portlet resource.
53      * @param action the secured action to be performed on the resource by the user.
54      * @return boolean true if the user has sufficient privilege.
55      */

56     final public boolean checkPermission(JetspeedUser user, Portlet portlet, String JavaDoc action)
57     {
58         return checkPermission(user, portlet, action, null);
59     }
60
61     /**
62      * Given a <code>JetspeedUser</code>, authorize that user to perform the secured action on
63      * the given <code>Portlet</code> resource. If the user does not have
64      * sufficient privilege to perform the action on the resource, the check returns false,
65      * otherwise when sufficient privilege is present, checkPermission returns true.
66      *
67      * @param user the user to be checked.
68      * @param portlet the portlet resource.
69      * @param action the secured action to be performed on the resource by the user.
70      * @param owner of the entry, i.e. the username
71      * @return boolean true if the user has sufficient privilege.
72      */

73     final public boolean checkPermission(JetspeedUser user, Portlet portlet, String JavaDoc action, String JavaDoc owner)
74     {
75         return true;
76     }
77     
78     /**
79      * Given a <code>JetspeedUser</code>, authorize that user to perform the secured action on
80      * the given Portlet Instance (<code>Entry</code>) resource. If the user does not have
81      * sufficient privilege to perform the action on the resource, the check returns false,
82      * otherwise when sufficient privilege is present, checkPermission returns true.
83      *
84      * @param user the user to be checked.
85      * @param entry the portlet instance resource.
86      * @param action the secured action to be performed on the resource by the user.
87      * @return boolean true if the user has sufficient privilege.
88      */

89     final public boolean checkPermission(JetspeedUser user, Entry entry, String JavaDoc action)
90     {
91         return checkPermission(user, entry, action, null);
92     }
93
94     
95     /**
96      * Given a <code>JetspeedUser</code>, authorize that user to perform the secured action on
97      * the given Portlet Instance (<code>Entry</code>) resource. If the user does not have
98      * sufficient privilege to perform the action on the resource, the check returns false,
99      * otherwise when sufficient privilege is present, checkPermission returns true.
100      *
101      * @param user the user to be checked.
102      * @param entry the portlet instance resource.
103      * @param action the secured action to be performed on the resource by the user.
104      * @param owner of the entry, i.e. the username
105      * @return boolean true if the user has sufficient privilege.
106      */

107     final public boolean checkPermission(JetspeedUser user, Entry entry, String JavaDoc action, String JavaDoc owner)
108     {
109         return true;
110     }
111     
112     
113     /**
114      * Given a <code>JetspeedUser</code>, authorize that user to perform the secured action on
115      * the given resource. If the user does not have
116      * sufficient privilege to perform the action on the resource, the check returns false,
117      * otherwise when sufficient privilege is present, checkPermission returns true.
118      *
119      * @param user the user to be checked.
120      * @param resource requesting an action
121      * @param action the secured action to be performed on the resource by the user.
122      * @return boolean true if the user has sufficient privilege.
123      */

124     final public boolean checkPermission(JetspeedUser user, PortalResource resource, String JavaDoc action)
125     {
126         return true;
127     }
128     
129     
130     
131     /*
132      * Turbine Services Interface
133      */

134     
135     /**
136      * This is the early initialization method called by the
137      * Turbine <code>Service</code> framework
138      * @param conf The <code>ServletConfig</code>
139      * @exception throws a <code>InitializationException</code> if the service
140      * fails to initialize
141      */

142     public synchronized void init(ServletConfig JavaDoc conf)
143     throws InitializationException
144     {
145         if (getInit())
146         {
147             return;
148         }
149         
150         super.init(conf);
151         
152         setInit(true);
153     }
154     
155 }
156
157
Popular Tags