1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.kim.permission.mock; |
17 |
|
|
18 |
|
import org.kuali.rice.kim.bo.role.dto.KimPermissionInfo; |
19 |
|
import org.kuali.rice.kim.bo.role.dto.KimPermissionTemplateInfo; |
20 |
|
|
21 |
|
import java.util.*; |
22 |
|
import org.kuali.rice.kim.bo.Role; |
23 |
|
import org.kuali.rice.kim.bo.role.dto.DelegateMemberCompleteInfo; |
24 |
|
import org.kuali.rice.kim.bo.role.dto.DelegateTypeInfo; |
25 |
|
import org.kuali.rice.kim.bo.role.dto.KimRoleInfo; |
26 |
|
import org.kuali.rice.kim.bo.role.dto.PermissionAssigneeInfo; |
27 |
|
import org.kuali.rice.kim.bo.role.dto.RoleMemberCompleteInfo; |
28 |
|
import org.kuali.rice.kim.bo.role.dto.RoleMembershipInfo; |
29 |
|
import org.kuali.rice.kim.bo.role.dto.RoleResponsibilityActionInfo; |
30 |
|
import org.kuali.rice.kim.bo.role.dto.RoleResponsibilityInfo; |
31 |
|
import org.kuali.rice.kim.bo.types.dto.AttributeSet; |
32 |
|
import org.kuali.rice.kim.service.PermissionService; |
33 |
|
import org.kuali.rice.kim.service.PermissionUpdateService; |
34 |
|
import org.kuali.rice.kim.service.RoleManagementService; |
35 |
|
import org.kuali.rice.kim.service.RoleService; |
36 |
|
import org.kuali.rice.kim.service.RoleUpdateService; |
37 |
|
|
38 |
|
|
39 |
|
@author |
40 |
|
|
|
|
| 0% |
Uncovered Elements: 195 (195) |
Complexity: 65 |
Complexity Density: 0.7 |
|
41 |
|
public class PermissionServiceMockImpl implements PermissionService, |
42 |
|
PermissionUpdateService |
43 |
|
{ |
44 |
|
|
45 |
|
private transient Map<String, KimPermissionTemplateInfo> permissionTemplateCache = new HashMap<String, KimPermissionTemplateInfo>(); |
46 |
|
private transient Map<String, KimPermissionInfo> permissionCache = new HashMap<String, KimPermissionInfo>(); |
47 |
|
private transient Map<String, KimRoleInfo> roleCache = new HashMap<String, KimRoleInfo>(); |
48 |
|
private transient Map<String, RoleMembershipInfo> roleMembershipCache = new HashMap<String, RoleMembershipInfo>(); |
49 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
0
|
@Override... |
51 |
|
public List<KimPermissionTemplateInfo> getAllTemplates() { |
52 |
0
|
return new ArrayList(this.permissionTemplateCache.values()); |
53 |
|
} |
54 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 6 |
Complexity Density: 0.67 |
|
55 |
0
|
@Override... |
56 |
|
public List<KimPermissionInfo> getAuthorizedPermissions(String principalId, |
57 |
|
String namespaceCode, |
58 |
|
String permissionName, |
59 |
|
AttributeSet permissionDetails, |
60 |
|
AttributeSet qualification) { |
61 |
0
|
List<KimPermissionInfo> list = new ArrayList<KimPermissionInfo>(); |
62 |
0
|
for (KimPermissionInfo permission : this.permissionCache.values()) { |
63 |
0
|
if (namespaceCode.equals(permission.getNamespaceCode())) { |
64 |
0
|
if (permissionName.equals(permission.getName())) { |
65 |
0
|
if (matchesPermissionDetails(permission, permissionDetails)) { |
66 |
0
|
if (matchesQualification(permission, qualification)) { |
67 |
0
|
if (matchesPrincipalId(permission, principalId)) { |
68 |
0
|
list.add(permission); |
69 |
|
} |
70 |
|
} |
71 |
|
} |
72 |
|
} |
73 |
|
} |
74 |
|
} |
75 |
0
|
return list; |
76 |
|
} |
77 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
78 |
0
|
private boolean matchesPermissionDetails(KimPermissionInfo permission, AttributeSet permissionDetails) {... |
79 |
|
|
80 |
0
|
return true; |
81 |
|
} |
82 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
83 |
0
|
private boolean matchesQualification(KimPermissionInfo permission, AttributeSet qualification) {... |
84 |
|
|
85 |
0
|
return true; |
86 |
|
} |
87 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
88 |
0
|
private boolean matchesPrincipalId(KimPermissionInfo permission, String principalId) {... |
89 |
|
|
90 |
0
|
return true; |
91 |
|
} |
92 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 7 |
Complexity Density: 0.7 |
|
93 |
0
|
@Override... |
94 |
|
public List<KimPermissionInfo> getAuthorizedPermissionsByTemplateName(String principalId, |
95 |
|
String namespaceCode, |
96 |
|
String permissionTemplateName, |
97 |
|
AttributeSet permissionDetails, |
98 |
|
AttributeSet qualification) { |
99 |
0
|
List<KimPermissionInfo> list = new ArrayList<KimPermissionInfo>(); |
100 |
0
|
for (KimPermissionInfo permission : this.permissionCache.values()) { |
101 |
0
|
if (permission.getTemplate() != null) { |
102 |
0
|
if (namespaceCode.equals(permission.getTemplate().getNamespaceCode())) { |
103 |
0
|
if (permissionTemplateName.equals(permission.getTemplate().getName())) { |
104 |
0
|
if (matchesPermissionDetails(permission, permissionDetails)) { |
105 |
0
|
if (matchesQualification(permission, qualification)) { |
106 |
0
|
if (matchesPrincipalId(permission, principalId)) { |
107 |
0
|
list.add(permission); |
108 |
|
} |
109 |
|
} |
110 |
|
} |
111 |
|
} |
112 |
|
} |
113 |
|
} |
114 |
|
} |
115 |
0
|
return list; |
116 |
|
} |
117 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
118 |
0
|
@Override... |
119 |
|
public KimPermissionInfo getPermission(String permissionId) { |
120 |
0
|
return this.permissionCache.get(permissionId); |
121 |
|
} |
122 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 5 |
Complexity Density: 0.62 |
|
123 |
0
|
@Override... |
124 |
|
public List<PermissionAssigneeInfo> getPermissionAssignees(String namespaceCode, |
125 |
|
String permissionName, |
126 |
|
AttributeSet permissionDetails, |
127 |
|
AttributeSet qualification) { |
128 |
0
|
List<PermissionAssigneeInfo> list = new ArrayList<PermissionAssigneeInfo>(); |
129 |
0
|
for (KimPermissionInfo permission : this.permissionCache.values()) { |
130 |
0
|
if (namespaceCode.equals(permission.getNamespaceCode())) { |
131 |
0
|
if (permissionName.equals(permission.getName())) { |
132 |
0
|
if (matchesPermissionDetails(permission, permissionDetails)) { |
133 |
0
|
if (matchesQualification(permission, qualification)) { |
134 |
0
|
list.addAll(getPermissionAssignees(permission)); |
135 |
|
} |
136 |
|
} |
137 |
|
} |
138 |
|
} |
139 |
|
} |
140 |
0
|
return list; |
141 |
|
} |
142 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
143 |
0
|
private List<PermissionAssigneeInfo> getPermissionAssignees(KimPermissionInfo permission) {... |
144 |
0
|
List<PermissionAssigneeInfo> list = new ArrayList<PermissionAssigneeInfo>(); |
145 |
|
|
146 |
0
|
return list; |
147 |
|
} |
148 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 6 |
Complexity Density: 0.67 |
|
149 |
0
|
@Override... |
150 |
|
public List<PermissionAssigneeInfo> getPermissionAssigneesForTemplateName(String namespaceCode, |
151 |
|
String permissionTemplateName, |
152 |
|
AttributeSet permissionDetails, |
153 |
|
AttributeSet qualification) { |
154 |
0
|
List<PermissionAssigneeInfo> list = new ArrayList<PermissionAssigneeInfo>(); |
155 |
0
|
for (KimPermissionInfo permission : this.permissionCache.values()) { |
156 |
0
|
if (permission.getTemplate() != null) { |
157 |
0
|
if (namespaceCode.equals(permission.getTemplate().getNamespaceCode())) { |
158 |
0
|
if (permissionTemplateName.equals(permission.getTemplate().getName())) { |
159 |
0
|
if (matchesPermissionDetails(permission, permissionDetails)) { |
160 |
0
|
if (matchesQualification(permission, qualification)) { |
161 |
0
|
list.addAll(getPermissionAssignees(permission)); |
162 |
|
} |
163 |
|
} |
164 |
|
} |
165 |
|
} |
166 |
|
} |
167 |
|
} |
168 |
0
|
return list; |
169 |
|
} |
170 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
171 |
0
|
@Override... |
172 |
|
public String getPermissionDetailLabel(String permissionId, String kimTypeId, |
173 |
|
String attributeName) { |
174 |
|
|
175 |
0
|
throw new UnsupportedOperationException("Not supported yet."); |
176 |
|
} |
177 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
178 |
0
|
@Override... |
179 |
|
public KimPermissionTemplateInfo getPermissionTemplate(String permissionTemplateId) { |
180 |
0
|
return this.permissionTemplateCache.get(permissionTemplateId); |
181 |
|
} |
182 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
183 |
0
|
@Override... |
184 |
|
public KimPermissionTemplateInfo getPermissionTemplateByName(String namespaceCode, |
185 |
|
String permissionTemplateName) { |
186 |
0
|
for (KimPermissionTemplateInfo template : this.permissionTemplateCache.values()) { |
187 |
0
|
if (template.getNamespaceCode().equals(namespaceCode)) { |
188 |
0
|
if (template.getName().equals(permissionTemplateName)) { |
189 |
0
|
return template; |
190 |
|
} |
191 |
|
} |
192 |
|
} |
193 |
0
|
return null; |
194 |
|
} |
195 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
196 |
0
|
@Override... |
197 |
|
public List<KimPermissionInfo> getPermissionsByName(String namespaceCode, |
198 |
|
String permissionName) { |
199 |
0
|
List<KimPermissionInfo> list = new ArrayList<KimPermissionInfo>(); |
200 |
0
|
for (KimPermissionInfo permission : this.permissionCache.values()) { |
201 |
0
|
if (namespaceCode.equals(permission.getNamespaceCode())) { |
202 |
0
|
if (permissionName.equals(permission.getName())) { |
203 |
0
|
if (permission.isActive()) { |
204 |
0
|
list.add(permission); |
205 |
|
} |
206 |
|
} |
207 |
|
} |
208 |
|
} |
209 |
0
|
return list; |
210 |
|
} |
211 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
212 |
0
|
@Override... |
213 |
|
public List<KimPermissionInfo> getPermissionsByNameIncludingInactive(String namespaceCode, |
214 |
|
String permissionName) { |
215 |
0
|
List<KimPermissionInfo> list = new ArrayList<KimPermissionInfo>(); |
216 |
0
|
for (KimPermissionInfo permission : this.permissionCache.values()) { |
217 |
0
|
if (namespaceCode.equals(permission.getNamespaceCode())) { |
218 |
0
|
if (permissionName.equals(permission.getName())) { |
219 |
0
|
list.add(permission); |
220 |
|
} |
221 |
|
} |
222 |
|
} |
223 |
0
|
return list; |
224 |
|
} |
225 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
226 |
0
|
@Override... |
227 |
|
public List<KimPermissionInfo> getPermissionsByTemplateName(String namespaceCode, |
228 |
|
String permissionTemplateName) { |
229 |
0
|
List<KimPermissionInfo> list = new ArrayList<KimPermissionInfo>(); |
230 |
0
|
for (KimPermissionInfo permission : this.permissionCache.values()) { |
231 |
0
|
if (permission.getTemplate() != null) { |
232 |
0
|
if (namespaceCode.equals(permission.getTemplate().getNamespaceCode())) { |
233 |
0
|
if (permissionTemplateName.equals(permission.getTemplate().getName())) { |
234 |
0
|
list.add(permission); |
235 |
|
} |
236 |
|
} |
237 |
|
} |
238 |
|
} |
239 |
0
|
return list; |
240 |
|
} |
241 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
242 |
0
|
@Override... |
243 |
|
public List<String> getRoleIdsForPermission(String namespaceCode, |
244 |
|
String permissionName, |
245 |
|
AttributeSet permissionDetails) { |
246 |
0
|
throw new UnsupportedOperationException("Not supported yet."); |
247 |
|
} |
248 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
249 |
0
|
@Override... |
250 |
|
public List<String> getRoleIdsForPermissionId(String permissionId) { |
251 |
0
|
throw new UnsupportedOperationException("Not supported yet."); |
252 |
|
} |
253 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
254 |
0
|
@Override... |
255 |
|
public List<String> getRoleIdsForPermissions(List<KimPermissionInfo> permissions) { |
256 |
0
|
throw new UnsupportedOperationException("Not supported yet."); |
257 |
|
} |
258 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
259 |
0
|
@Override... |
260 |
|
public boolean hasPermission(String principalId, String namespaceCode, |
261 |
|
String permissionName, |
262 |
|
AttributeSet permissionDetails) { |
263 |
0
|
throw new UnsupportedOperationException("Not supported yet."); |
264 |
|
} |
265 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
266 |
0
|
@Override... |
267 |
|
public boolean hasPermissionByTemplateName(String principalId, |
268 |
|
String namespaceCode, |
269 |
|
String permissionTemplateName, |
270 |
|
AttributeSet permissionDetails) { |
271 |
0
|
throw new UnsupportedOperationException("Not supported yet."); |
272 |
|
} |
273 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
274 |
0
|
@Override... |
275 |
|
public boolean isAuthorized(String principalId, String namespaceCode, |
276 |
|
String permissionName, |
277 |
|
AttributeSet permissionDetails, |
278 |
|
AttributeSet qualification) { |
279 |
0
|
throw new UnsupportedOperationException("Not supported yet."); |
280 |
|
} |
281 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
282 |
0
|
@Override... |
283 |
|
public boolean isAuthorizedByTemplateName(String principalId, |
284 |
|
String namespaceCode, |
285 |
|
String permissionTemplateName, |
286 |
|
AttributeSet permissionDetails, |
287 |
|
AttributeSet qualification) { |
288 |
0
|
throw new UnsupportedOperationException("Not supported yet."); |
289 |
|
} |
290 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 4 |
Complexity Density: 0.67 |
|
291 |
0
|
@Override... |
292 |
|
public boolean isPermissionDefined(String namespaceCode, String permissionName, |
293 |
|
AttributeSet permissionDetails) { |
294 |
0
|
for (KimPermissionInfo permission : this.permissionCache.values()) { |
295 |
0
|
if (namespaceCode.equals(permission.getNamespaceCode())) { |
296 |
0
|
if (permissionName.equals(permission.getName())) { |
297 |
0
|
if (matchesPermissionDetails(permission, permissionDetails)) { |
298 |
0
|
return true; |
299 |
|
} |
300 |
|
} |
301 |
|
} |
302 |
|
} |
303 |
|
|
304 |
0
|
return false; |
305 |
|
} |
306 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 5 |
Complexity Density: 0.71 |
|
307 |
0
|
@Override... |
308 |
|
public boolean isPermissionDefinedForTemplateName(String namespaceCode, |
309 |
|
String permissionTemplateName, |
310 |
|
AttributeSet permissionDetails) { |
311 |
0
|
for (KimPermissionInfo permission : this.permissionCache.values()) { |
312 |
0
|
if (permission.getTemplate() != null) { |
313 |
0
|
if (namespaceCode.equals(permission.getTemplate().getNamespaceCode())) { |
314 |
0
|
if (permissionTemplateName.equals(permission.getTemplate().getName())) { |
315 |
0
|
if (matchesPermissionDetails(permission, permissionDetails)) { |
316 |
0
|
return true; |
317 |
|
} |
318 |
|
} |
319 |
|
} |
320 |
|
} |
321 |
|
} |
322 |
0
|
return false; |
323 |
|
} |
324 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
325 |
0
|
@Override... |
326 |
|
public List<KimPermissionInfo> lookupPermissions(Map<String, String> searchCriteria, |
327 |
|
boolean unbounded) { |
328 |
0
|
throw new UnsupportedOperationException("Not supported yet."); |
329 |
|
} |
330 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
331 |
0
|
@Override... |
332 |
|
public String getNextAvailablePermissionId() throws UnsupportedOperationException { |
333 |
0
|
throw new UnsupportedOperationException("Not supported yet."); |
334 |
|
} |
335 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
336 |
0
|
@Override... |
337 |
|
public void savePermission(String permissionId, String permissionTemplateId, |
338 |
|
String namespaceCode, String name, |
339 |
|
String description, boolean active, |
340 |
|
AttributeSet permissionDetails) { |
341 |
0
|
throw new UnsupportedOperationException("Not supported yet."); |
342 |
|
} |
343 |
|
|
344 |
|
} |
345 |
|
|