View Javadoc

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;
18  
19  import java.util.Iterator;
20  
21  import org.apache.jetspeed.om.security.Group;
22  import org.apache.jetspeed.om.security.Permission;
23  import org.apache.jetspeed.om.security.Role;
24  import org.apache.turbine.services.Service;
25  
26  /***
27   * The Security Cache Service caches roles and permissions (ACLs)
28   *
29   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
30   * @version $Id: SecurityCacheService.java,v 1.8 2004/02/23 03:58:11 jford Exp $
31   */
32  
33  
34  public interface SecurityCacheService extends Service
35  {
36     /*** The name of this service */
37     public String SERVICE_NAME = "SecurityCache";
38  
39     /*
40      * Loads the security cache for the given user.
41      *
42      * @param username the user to cache all role and permission information for.
43      */
44      public void load(String username)
45          throws JetspeedSecurityException;
46  
47      /*
48       * UnLoads the security cache for the given user.
49       *
50       * @param username the user to cache all role and permission information for.
51       */
52      public void unload(String username);
53  
54  
55      public void loadRolePermissions();
56  
57      /***
58       *  Retrieves a role from the cache for the given username.
59       *
60       * @param username The name key of the user.
61       * @param roleName The name of the role.
62       */ 
63      public Role getRole(String username, String roleName);
64      
65  	public Role getRole(String username, String roleName, String groupName);
66  	
67      /***
68       *  Retrieves a role from the cache for the given username.
69       *
70       */ 
71      public void addRole(Role role);
72  
73      public void addRole(String username, Role role);
74      
75  	public void addRole(String username, Role role, Group group);
76  
77      public boolean hasRole(String username, String roleName);
78      
79  	public boolean hasRole(String username, String roleName, String groupName);
80  
81      public void removeRole(String username, String roleName);
82      
83  	public void removeRole(String username, String roleName, String groupName);
84  
85      public Iterator getRoles(String username);
86  
87      public CachedAcl getAcl(String username);
88  
89      public Permission getPermission(String roleName, String permissionName);
90      
91      public void addPermission(String roleName, Permission permission);
92  
93      public boolean hasPermission(String roleName, String permissionName);
94  
95      public void removePermission(String roleName, String permissionName);
96  
97      public Iterator getPermissions(String roleName);
98  
99      public void removeAllRoles(String rolename);
100 
101     public void removeAllPermissions(String permissionName);
102 
103 }
104 
105 
106