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;
2122// Jetspeed Security23import org.apache.jetspeed.services.security.PermissionManagement;
2425import org.apache.jetspeed.om.security.Permission;
2627import org.apache.jetspeed.om.security.BaseJetspeedPermission;
2829// Jetspeed Security Exceptions30import org.apache.jetspeed.services.security.JetspeedSecurityException;
3132// Turbine33import org.apache.turbine.services.TurbineBaseService;
3435/***36 * <p> The <code>NoPermissionManagement</code> class is a Jetspeed37 * security provider, implementing the <code>PermissionManagement</code> interface.38 * It provides no permission management - no roles have permissions, no permissions are39 * saved, and requests for any permission is satisfied with a temp. Permission object.40 *41 * @author <a href="mailto:ggolden@apache.org">Glenn R. Golden</a>42 * @version $Id: NoPermissionManagement.java,v 1.3 2004/02/23 03:53:24 jford Exp $43 */44publicclassNoPermissionManagement45extends TurbineBaseService
46 implements PermissionManagement47 {
48/***49 * Retrieves all <code>Permission</code>s for a given rolename 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 rolename a role name identity to be retrieved.55 * @return Iterator over all permissions associated to the role principal.56 * @exception PermissionException when the security provider has a general failure.57 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege 58 */59public Iterator getPermissions(String rolename)
60 throws JetspeedSecurityException61 {
62returnnew Vector().iterator();
63 }
6465/***66 * Retrieves all <code>Permission</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 permissions.72 * @exception PermissionException when the security provider has a general failure.73 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege 74 */75public Iterator getPermissions()
76 throws JetspeedSecurityException77 {
78returnnew Vector().iterator();
79 }
8081/***82 * Adds a <code>Permission</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 PermissionException when the security provider has a general failure.88 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege 89 */90publicvoid addPermission(Permission permission)
91 throws JetspeedSecurityException92 {
93 }
9495/***96 * Saves a <code>Permission</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 PermissionException when the security provider has a general failure.102 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege 103 */104publicvoid savePermission(Permission permission)
105 throws JetspeedSecurityException106 {
107 }
108109/***110 * Removes a <code>Permission</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 permissionName the principal identity of the permission to be retrieved.116 * @exception PermissionException when the security provider has a general failure.117 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege 118 */119publicvoid removePermission(String permissionName)
120 throws JetspeedSecurityException121 {
122 }
123124/***125 * Grants a permission to a role. 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 * @param roleName grant a permission to this role.131 * @param permissionName the permission to grant to the role.132 * @exception PermissionException when the security provider has a general failure retrieving permissions.133 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege 134 */135publicvoid grantPermission(String roleName, String permissionName)
136 throws JetspeedSecurityException137 {
138 }
139140/***141 * Revokes a permission from a role. 142 *143 * The security service may optionally check the current user context144 * to determine if the requestor has permission to perform this action.145 *146 * @param roleName grant a permission to this role.147 * @param permissionName the permission to grant to the role. 148 * @exception PermissionException when the security provider has a general failure retrieving permissions.149 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege 150 */151publicvoid revokePermission(String roleName, String permissionName)
152 throws JetspeedSecurityException153 {
154 }
155156/***157 * Checks for the relationship of role has a permission. Returns true when the role has the given permission.158 *159 * The security service may optionally check the current user context160 * to determine if the requestor has permission to perform this action.161 *162 * @param roleName grant a permission to this role.163 * @param permissionName the permission to grant to the role. 164 * @exception PermissionException when the security provider has a general failure retrieving permissions.165 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege 166 */167publicboolean hasPermission(String roleName, String permissionName)
168 throws JetspeedSecurityException169 {
170return false;
171 }
172173/***174 * Retrieves a single <code>Permission</code> for a given permissionName principal.175 * 176 * The security service may optionally check the current user context177 * to determine if the requestor has permission to perform this action.178 *179 * @param permissionName a permission principal identity to be retrieved.180 * @return Permission the permission record retrieved.181 * @exception PermissionException when the security provider has a general failure.182 * @exception InsufficientPrivilegeException when the requestor is denied due to insufficient privilege 183 */184publicPermission getPermission(String permissionName)
185 throws JetspeedSecurityException186 {
187BaseJetspeedPermission r = newBaseJetspeedPermission();
188//r.setNew(false);189 r.setName(permissionName);
190 r.setId(permissionName);
191return r;
192 }
193 }
194