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 at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * 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 and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.services.security.nosecurity;
1819import java.util.Iterator;
20import java.util.Vector;
21import java.util.HashMap;
2223// Jetspeed Security24import org.apache.jetspeed.services.security.GroupManagement;
2526import org.apache.jetspeed.om.security.Group;
27import org.apache.jetspeed.om.security.BaseJetspeedGroup;
2829// Jetspeed Security Exceptions30import org.apache.jetspeed.services.security.JetspeedSecurityException;
3132// Turbine33import org.apache.turbine.services.TurbineBaseService;
3435/***36 * <p> The <code>NoGroupManagement</code> class is a Jetspeed37 * security provider, implementing the <code>GroupManagement</code> interface.38 * It provides no group management - no groups are listed, no groups are saved,39 * no users are in any groups, any request for a group is satisfied with a temporary Group object.40 *41 * @author <a href="mailto:ggolden@apache.org">Glenn R. Golden</a>42 * @version $Id: NoGroupManagement.java,v 1.3 2004/02/23 03:53:24 jford Exp $43 */44publicclassNoGroupManagement45extends TurbineBaseService
46 implements GroupManagement47 {
48/***49 * Retrieves all <code>Group</code>s for a given username principal.50 *51 * The security service may optionally check the current user context52 * to determine if the requestor has permission to perform this action.53 *54 * @param username a user principal identity to be retrieved.55 * @return Iterator over all groups associated to the user principal.56 * @exception GroupException when the security provider has a general failure.57 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege58 */59public Iterator getGroups(String username)
60 throws JetspeedSecurityException61 {
62returnnew Vector().iterator();
63 }
6465/***66 * Retrieves all <code>Group</code>s.67 *68 * The security service may optionally check the current user context69 * to determine if the requestor has permission to perform this action.70 *71 * @return Iterator over all groups.72 * @exception GroupException when the security provider has a general failure.73 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege74 */75public Iterator getGroups()
76 throws JetspeedSecurityException77 {
78returnnew Vector().iterator();
79 }
8081/***82 * Adds a <code>Group</code> into permanent storage.83 *84 * The security service may optionally check the current user context85 * to determine if the requestor has permission to perform this action.86 *87 * @exception GroupException when the security provider has a general failure.88 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege89 */90publicvoid addGroup(Group group)
91 throws JetspeedSecurityException92 {
93 }
9495/***96 * Saves a <code>Group</code> into permanent storage.97 *98 * The security service may optionally check the current user context99 * to determine if the requestor has permission to perform this action.100 *101 * @exception GroupException when the security provider has a general failure.102 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege103 */104publicvoid saveGroup(Group group)
105 throws JetspeedSecurityException106 {
107 }
108109/***110 * Removes a <code>Group</code> from the permanent store.111 *112 * The security service may optionally check the current user context113 * to determine if the requestor has permission to perform this action.114 *115 * @param groupname the principal identity of the group to be retrieved.116 * @exception GroupException when the security provider has a general failure.117 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege118 */119publicvoid removeGroup(String groupname)
120 throws JetspeedSecurityException121 {
122 }
123124/***125 * Joins a user to a group.126 *127 * The security service may optionally check the current user context128 * to determine if the requestor has permission to perform this action.129 *130 * @exception GroupException when the security provider has a general failure retrieving groups.131 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege132 */133publicvoid joinGroup(String username, String groupname)
134 throws JetspeedSecurityException135 {
136 }
137138/***139 * Join a user to a group - specific role.140 *141 * The security service may optionally check the current user context142 * to determine if the requestor has permission to perform this action.143 *144 * @exception GroupException when the security provider has a general failure retrieving groups.145 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege146 */147publicvoid joinGroup(String username, String groupname, String rolename)
148 throws JetspeedSecurityException149 {
150 }
151152/***153 * Unjoins a user from a group.154 *155 * The security service may optionally check the current user context156 * to determine if the requestor has permission to perform this action.157 *158 * @exception GroupException when the security provider has a general failure retrieving groups.159 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege160 */161publicvoid unjoinGroup(String username, String groupname)
162 throws JetspeedSecurityException163 {
164 }
165166/***167 * Unjoin a user from a group in which the user has a specific role instead of <Code>JetspeedSecurity.getRole(defaultRole)</Code>168 *169 * The security service may optionally check the current user context170 * to determine if the requestor has permission to perform this action.171 *172 * @exception GroupException when the security provider has a general failure retrieving groups.173 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege174 */175176publicvoid unjoinGroup(String username, String groupname, String rolename)
177 throws JetspeedSecurityException178 {
179 }
180181182/***183 * Checks for the relationship of user in a group. Returns true when the user is in the given group.184 *185 * The security service may optionally check the current user context186 * to determine if the requestor has permission to perform this action.187 *188 * @exception GroupException when the security provider has a general failure retrieving groups.189 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege190 */191publicboolean inGroup(String username, String groupname)
192 throws JetspeedSecurityException193 {
194return false;
195 }
196197/***198 * Retrieves a single <code>Group</code> for a given groupname principal.199 *200 * The security service may optionally check the current user context201 * to determine if the requestor has permission to perform this action.202 *203 * @param groupname a group principal identity to be retrieved.204 * @return Group the group record retrieved.205 * @exception GroupException when the security provider has a general failure.206 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege207 */208publicGroup getGroup(String groupname)
209 throws JetspeedSecurityException210 {
211BaseJetspeedGroup r = newBaseJetspeedGroup();
212//r.setNew(false);213 r.setName(groupname);
214 r.setId(groupname);
215return r;
216 }
217218/***219 * Retrieves a hashtable which associates Groups with Roles for a given username principal.220 *221 * The security service may optionally check the current user context222 * to determine if the requestor has permission to perform this action.223 *224 * @param username a user principal identity to be retrieved.225 * @return Hashtable record retrieved.226 * @exception GroupException when the security provider has a general failure.227 */228public HashMap getTurbineGroupRole(String username)
229 throws JetspeedSecurityException230 {
231 HashMap h = new HashMap();
232return h;
233 }
234 }
235