1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.api.permission;
17
18 import org.kuali.rice.core.api.criteria.QueryByCriteria;
19 import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
20 import org.kuali.rice.core.api.exception.RiceIllegalStateException;
21 import org.kuali.rice.core.api.util.jaxb.MapStringStringAdapter;
22 import org.kuali.rice.kim.api.KimConstants;
23 import org.kuali.rice.kim.api.common.assignee.Assignee;
24 import org.kuali.rice.kim.api.common.template.Template;
25 import org.kuali.rice.kim.api.common.template.TemplateQueryResults;
26 import org.springframework.cache.annotation.CacheEvict;
27 import org.springframework.cache.annotation.Cacheable;
28
29 import javax.jws.WebMethod;
30 import javax.jws.WebParam;
31 import javax.jws.WebResult;
32 import javax.jws.WebService;
33 import javax.jws.soap.SOAPBinding;
34 import javax.xml.bind.annotation.XmlElement;
35 import javax.xml.bind.annotation.XmlElementWrapper;
36 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
37 import java.util.List;
38 import java.util.Map;
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 @WebService(name = "permissionService", targetNamespace = KimConstants.Namespaces.KIM_NAMESPACE_2_0)
66 @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
67 public interface PermissionService {
68
69
70
71
72
73
74
75
76
77 @WebMethod(operationName="createPermission")
78 @WebResult(name = "permission")
79 @CacheEvict(value={Permission.Cache.NAME, Template.Cache.NAME + "{Permission}"}, allEntries = true)
80 Permission createPermission(@WebParam(name = "permission") Permission permission)
81 throws RiceIllegalArgumentException, RiceIllegalStateException;
82
83
84
85
86
87
88
89
90 @WebMethod(operationName="updatePermission")
91 @WebResult(name = "permission")
92 @CacheEvict(value={Permission.Cache.NAME, Template.Cache.NAME + "{Permission}"}, allEntries = true)
93 Permission updatePermission(@WebParam(name = "permission") Permission permission)
94 throws RiceIllegalArgumentException, RiceIllegalStateException;
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112 @WebMethod(operationName = "hasPermission")
113 @WebResult(name = "hasPermission")
114 boolean hasPermission( @WebParam(name="principalId") String principalId,
115 @WebParam(name="namespaceCode") String namespaceCode,
116 @WebParam(name="permissionName") String permissionName,
117 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
118 @WebParam(name="permissionDetails") Map<String, String> permissionDetails ) throws RiceIllegalArgumentException;
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135 @WebMethod(operationName = "isAuthorized")
136 @WebResult(name = "isAuthorized")
137 boolean isAuthorized( @WebParam(name="principalId") String principalId,
138 @WebParam(name="namespaceCode") String namespaceCode,
139 @WebParam(name="permissionName") String permissionName,
140 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
141 @WebParam(name="permissionDetails") Map<String, String> permissionDetails,
142 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
143 @WebParam(name="qualification") Map<String, String> qualification ) throws RiceIllegalArgumentException;
144
145
146
147
148
149
150
151
152
153
154
155
156
157 @WebMethod(operationName = "hasPermissionByTemplateName")
158 @WebResult(name = "hasPermission")
159 boolean hasPermissionByTemplateName( @WebParam(name="principalId") String principalId,
160 @WebParam(name="namespaceCode") String namespaceCode,
161 @WebParam(name="permissionTemplateName") String permissionTemplateName,
162 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
163 @WebParam(name="permissionDetails") Map<String, String> permissionDetails ) throws RiceIllegalArgumentException;
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179 @WebMethod(operationName = "isAuthorizedByTemplateName")
180 @WebResult(name = "isAuthorized")
181 boolean isAuthorizedByTemplateName( @WebParam(name="principalId") String principalId,
182 @WebParam(name="namespaceCode") String namespaceCode,
183 @WebParam(name="permissionTemplateName") String permissionTemplateName,
184 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
185 @WebParam(name="permissionDetails") Map<String, String> permissionDetails,
186 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
187 @WebParam(name="qualification") Map<String, String> qualification ) throws RiceIllegalArgumentException;
188
189
190
191
192
193
194
195
196
197
198
199
200
201 @WebMethod(operationName = "getPermissionAssignees")
202 @XmlElementWrapper(name = "assignees", required = true)
203 @XmlElement(name = "assignee", required = false)
204 @WebResult(name = "assignees")
205 List<Assignee> getPermissionAssignees( @WebParam(name="namespaceCode") String namespaceCode,
206 @WebParam(name="permissionName") String permissionName,
207 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
208 @WebParam(name="permissionDetails") Map<String, String> permissionDetails,
209 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
210 @WebParam(name="qualification") Map<String, String> qualification ) throws RiceIllegalArgumentException;
211
212
213
214
215
216
217
218
219
220
221
222
223
224 @WebMethod(operationName = "getPermissionAssigneesByTemplateName")
225 @XmlElementWrapper(name = "assignees", required = true)
226 @XmlElement(name = "assignee", required = false)
227 @WebResult(name = "assignees")
228 List<Assignee> getPermissionAssigneesByTemplateName(@WebParam(name = "namespaceCode") String namespaceCode,
229 @WebParam(name = "permissionTemplateName") String permissionTemplateName,
230 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) @WebParam(
231 name = "permissionDetails") Map<String, String> permissionDetails,
232 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) @WebParam(
233 name = "qualification") Map<String, String> qualification) throws RiceIllegalArgumentException;
234
235
236
237
238 @WebMethod(operationName = "isPermissionDefined")
239 @WebResult(name = "isPermissionDefined")
240 boolean isPermissionDefined( @WebParam(name="namespaceCode") String namespaceCode,
241 @WebParam(name="permissionName") String permissionName,
242 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
243 @WebParam(name="permissionDetails") Map<String, String> permissionDetails ) throws RiceIllegalArgumentException;
244
245
246
247
248 @WebMethod(operationName = "isPermissionDefinedByTemplateName")
249 @WebResult(name = "isPermissionDefinedByTemplateName")
250 boolean isPermissionDefinedByTemplateName(@WebParam(name = "namespaceCode") String namespaceCode,
251 @WebParam(name = "permissionTemplateName") String permissionTemplateName,
252 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class) @WebParam(
253 name = "permissionDetails") Map<String, String> permissionDetails) throws RiceIllegalArgumentException;
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274 @WebMethod(operationName = "getAuthorizedPermissions")
275 @XmlElementWrapper(name = "permissions", required = true)
276 @XmlElement(name = "permission", required = false)
277 @WebResult(name = "permissions")
278 List<Permission> getAuthorizedPermissions( @WebParam(name="principalId") String principalId,
279 @WebParam(name="namespaceCode") String namespaceCode,
280 @WebParam(name="permissionName") String permissionName,
281 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
282 @WebParam(name="permissionDetails") Map<String, String> permissionDetails,
283 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
284 @WebParam(name="qualification") Map<String, String> qualification ) throws RiceIllegalArgumentException;
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305 @WebMethod(operationName = "getAuthorizedPermissionsByTemplateName")
306 @XmlElementWrapper(name = "permissions", required = true)
307 @XmlElement(name = "permission", required = false)
308 @WebResult(name = "permissions")
309 List<Permission> getAuthorizedPermissionsByTemplateName( @WebParam(name="principalId") String principalId,
310 @WebParam(name="namespaceCode") String namespaceCode,
311 @WebParam(name="permissionTemplateName") String permissionTemplateName,
312 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
313 @WebParam(name="permissionDetails") Map<String, String> permissionDetails,
314 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
315 @WebParam(name="qualification") Map<String, String> qualification ) throws RiceIllegalArgumentException;
316
317
318
319
320
321
322
323
324 @WebMethod(operationName = "getPermission")
325 @WebResult(name = "permission")
326 @Cacheable(value=Permission.Cache.NAME, key="'id=' + #p0")
327 Permission getPermission( @WebParam(name="id") String id );
328
329
330
331
332
333 @WebMethod(operationName = "findPermByNamespaceCodeAndName")
334 @WebResult(name = "permission")
335 @Cacheable(value=Permission.Cache.NAME, key="'namespaceCode=' + #p0 + '|' + 'name=' + #p1")
336 Permission findPermByNamespaceCodeAndName(@WebParam(name = "namespaceCode") String namespaceCode,
337 @WebParam(name = "name") String name) throws RiceIllegalArgumentException;
338
339
340
341
342
343 @WebMethod(operationName = "findPermsByNamespaceCodeTemplateName")
344 @WebResult(name = "permission")
345 @Cacheable(value=Permission.Cache.NAME, key="'namespaceCode=' + #p1 + '|' + 'templateName=' + #p2")
346 List<Permission> findPermsByNamespaceCodeTemplateName(@WebParam(name = "namespaceCode") String namespaceCode,
347 @WebParam(name = "templateName") String templateName) throws RiceIllegalArgumentException;
348
349
350
351
352
353
354
355
356 @WebMethod(operationName = "getPermissionTemplate")
357 @WebResult(name = "id")
358 @Cacheable(value=Template.Cache.NAME + "{Permission}", key="'id=' + #p0")
359 Template getPermissionTemplate( @WebParam(name="id") String id ) throws RiceIllegalArgumentException;
360
361
362
363
364
365
366
367
368 @WebMethod(operationName = "findPermTemplateByNamespaceCodeAndName")
369 @WebResult(name = "permissionTemplate")
370 @Cacheable(value=Template.Cache.NAME + "{Permission}", key="'namespaceCode=' + #p0 + '|' + 'name=' + #p1")
371 Template findPermTemplateByNamespaceCodeAndName(@WebParam(name = "namespaceCode") String namespaceCode,
372 @WebParam(name = "name") String name) throws RiceIllegalArgumentException;
373
374
375
376
377
378
379
380 @WebMethod(operationName = "getAllTemplates")
381 @XmlElementWrapper(name = "templates", required = true)
382 @XmlElement(name = "template", required = false)
383 @WebResult(name = "templates")
384 @Cacheable(value=Template.Cache.NAME + "{Permission}", key="'all'")
385 List<Template> getAllTemplates();
386
387
388
389
390 @WebMethod(operationName = "getRoleIdsForPermission")
391 @XmlElementWrapper(name = "roleIds", required = true)
392 @XmlElement(name = "roleId", required = false)
393 @WebResult(name = "roleIds")
394 List<String> getRoleIdsForPermission( @WebParam(name="namespaceCode") String namespaceCode,
395 @WebParam(name="permissionName") String permissionName,
396 @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
397 @WebParam(name="permissionDetails") Map<String, String> permissionDetails) throws RiceIllegalArgumentException;
398
399
400
401
402
403
404
405
406 @WebMethod(operationName = "findPermissions")
407 @WebResult(name = "results")
408 PermissionQueryResults findPermissions(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
409
410
411
412
413
414
415
416
417
418 @WebMethod(operationName = "findPermissionTemplates")
419 @WebResult(name = "results")
420 TemplateQueryResults findPermissionTemplates(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
421 }