1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.jetspeed.services.security;
19
20 import java.util.Iterator;
21
22 import org.apache.jetspeed.om.security.Group;
23 import org.apache.jetspeed.om.security.Permission;
24 import org.apache.jetspeed.om.security.Role;
25 import org.apache.turbine.services.TurbineServices;
26
27 /***
28 * The Security Cache Service caches roles and permissions (ACLs)
29 *
30 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
31 * @version $Id: JetspeedSecurityCache.java,v 1.8 2004/02/23 03:58:11 jford Exp $
32 */
33
34
35 public abstract class JetspeedSecurityCache
36 {
37 /*** The name of this service */
38 public String SERVICE_NAME = "SecurityCache";
39
40
41
42
43
44
45
46
47 protected static SecurityCacheService getService()
48 {
49 return (SecurityCacheService)TurbineServices
50 .getInstance().getService(SecurityCacheService.SERVICE_NAME);
51 }
52
53
54
55
56
57
58
59
60
61
62
63 public static void load(String username)
64 throws JetspeedSecurityException
65 {
66 getService().load(username);
67 }
68
69 public static void unload(String username)
70 {
71 getService().unload(username);
72 }
73
74 public static void loadRolePermissions()
75 {
76 getService().loadRolePermissions();
77 }
78
79 public static Role getRole(String username, String roleName)
80 {
81 return getService().getRole(username, roleName);
82 }
83
84 public static Role getRole(String username, String roleName, String groupName)
85 {
86 return getService().getRole(username, roleName, groupName);
87 }
88
89 public static void addRole(Role role)
90 {
91 getService().addRole(role);
92 }
93
94 public static void addRole(String username, Role role)
95 {
96 getService().addRole(username, role);
97 }
98
99 public static void addRole(String username, Role role, Group group)
100 {
101 getService().addRole(username, role, group);
102 }
103
104 public static boolean hasRole(String username, String roleName)
105 {
106 return getService().hasRole(username, roleName);
107 }
108
109 public static boolean hasRole(String username, String roleName, String groupName)
110 {
111 return getService().hasRole(username, roleName, groupName);
112 }
113
114 public static void removeRole(String username, String roleName)
115 {
116 getService().removeRole(username, roleName);
117 }
118
119 public static void removeRole(String username, String roleName, String groupName)
120 {
121 getService().removeRole(username, roleName, groupName);
122 }
123
124 public static Iterator getRoles(String username)
125 {
126 return getService().getRoles(username);
127 }
128
129 public static CachedAcl getAcl(String username)
130 {
131 return getService().getAcl(username);
132 }
133
134 public static void removeAllRoles(String rolename)
135 {
136 getService().removeAllRoles(rolename);
137 }
138
139 public static void removeAllPermissions(String permissionName)
140 {
141 getService().removeAllPermissions(permissionName);
142 }
143
144 public static Permission getPermission(String roleName, String permissionName)
145 {
146 return getService().getPermission(roleName, permissionName);
147 }
148
149 public static void addPermission(String roleName, Permission permission)
150 {
151 getService().addPermission(roleName, permission);
152 }
153
154 public static boolean hasPermission(String roleName, String permissionName)
155 {
156 return getService().hasPermission(roleName, permissionName);
157 }
158
159 public static void removePermission(String roleName, String permissionName)
160 {
161 getService().removePermission(roleName, permissionName);
162 }
163
164 public static Iterator getPermissions(String roleName)
165 {
166 return getService().getPermissions(roleName);
167 }
168
169 }
170
171
172