KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > security > StandardSecurityManager


1 package org.enhydra.shark.security;
2
3
4 import java.util.*;
5
6 import org.enhydra.shark.api.RootException;
7 import org.enhydra.shark.api.SharkTransaction;
8 import org.enhydra.shark.api.internal.security.SecurityException;
9 import org.enhydra.shark.api.internal.security.SecurityManager;
10 import org.enhydra.shark.api.internal.working.CallbackUtilities;
11
12 /**
13  *
14  * @author Sasa Bojanic
15  *
16  */

17 public class StandardSecurityManager implements SecurityManager JavaDoc {
18
19    private static final String JavaDoc SECURITY_MODE_NO_SECURITY="NO_SECURITY";
20    private static final String JavaDoc SECURITY_MODE_NORMAL_SECURITY="NORMAL_SECURITY";
21    private static final String JavaDoc SECURITY_MODE_ADMIN_SECURITY="ADMIN_SECURITY";
22
23    private static final int SECURITY_MODE_NUM_NO_SECURITY=0;
24    private static final int SECURITY_MODE_NUM_NORMAL_SECURITY=1;
25    private static final int SECURITY_MODE_NUM_ADMIN_SECURITY=2;
26
27    private final static String JavaDoc ADMIN_USER_PREFIX="StandardSecurityManager.AdminUser";
28
29    private CallbackUtilities cus;
30
31    private int SECURITY_MODE=SECURITY_MODE_NUM_NORMAL_SECURITY;
32
33    private Set adminUsers=new HashSet();
34
35    public void configure (CallbackUtilities cus) throws RootException {
36       this.cus=cus;
37
38       String JavaDoc sec_m=cus.getProperty("StandardSecurityManager.SECURITY_MODE","NORMAL_SECURITY");
39       String JavaDoc sm=null;
40       if (sec_m.equals(SECURITY_MODE_NO_SECURITY)) {
41          SECURITY_MODE=SECURITY_MODE_NUM_NO_SECURITY;
42          sm=SECURITY_MODE_NO_SECURITY;
43       } else if (sec_m.equals(SECURITY_MODE_ADMIN_SECURITY)) {
44          SECURITY_MODE=SECURITY_MODE_NUM_ADMIN_SECURITY;
45          sm=SECURITY_MODE_ADMIN_SECURITY;
46       } else {
47          SECURITY_MODE=SECURITY_MODE_NUM_NORMAL_SECURITY;
48          sm=SECURITY_MODE_NORMAL_SECURITY;
49       }
50
51       cus.info("StandardSecurityManager -> Security mode set to "+sm);
52
53       Properties props= cus.getProperties();
54       Iterator it=props.entrySet().iterator();
55       while (it.hasNext()) {
56          try {
57             Map.Entry me=(Map.Entry)it.next();
58             String JavaDoc entry=me.getKey().toString();
59             if (entry.startsWith(ADMIN_USER_PREFIX)) {
60                String JavaDoc adminUser=me.getValue().toString();
61                adminUsers.add(adminUser);
62             }
63          } catch (Throwable JavaDoc ex) {
64             cus.error("StandardSecurityManager -> Error when retrieving list of admins from properties!!!");
65          }
66       }
67       System.out.println("Admin users are:"+adminUsers);
68    }
69
70    public List getAssignments (
71       SharkTransaction t,
72       String JavaDoc engineName,
73       String JavaDoc procId,
74       String JavaDoc actId,
75       List userIds) throws RootException {
76
77       return userIds;
78    }
79
80    // WfProcessMgr security methods
81
public void check_processmgr_how_many_process (SharkTransaction t,String JavaDoc name,String JavaDoc userId,String JavaDoc pkgId,String JavaDoc version,String JavaDoc pDefId) throws SecurityException JavaDoc {
82
83    }
84
85    public void check_processmgr_get_iterator_process (SharkTransaction t,String JavaDoc name,String JavaDoc userId,String JavaDoc pkgId,String JavaDoc version,String JavaDoc pDefId) throws SecurityException JavaDoc {
86       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
87          if (!adminUsers.contains(userId)) {
88             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for iterator over process manager's processes!");
89          }
90       }
91    }
92
93    public void check_processmgr_get_sequence_process (SharkTransaction t,String JavaDoc name,String JavaDoc userId,String JavaDoc pkgId,String JavaDoc version,String JavaDoc pDefId) throws SecurityException JavaDoc {
94       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
95          if (!adminUsers.contains(userId)) {
96             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for the list of the process manager's processes!");
97          }
98       }
99    }
100
101    public void check_processmgr_is_member_of_process (SharkTransaction t,String JavaDoc name,String JavaDoc userId,String JavaDoc pkgId,String JavaDoc version,String JavaDoc pDefId) throws SecurityException JavaDoc {
102    }
103
104    public void check_processmgr_process_mgr_state (SharkTransaction t,String JavaDoc name,String JavaDoc userId,String JavaDoc pkgId,String JavaDoc version,String JavaDoc pDefId) throws SecurityException JavaDoc {
105
106    }
107
108    public void check_processmgr_set_process_mgr_state (SharkTransaction t,String JavaDoc name,String JavaDoc userId,String JavaDoc pkgId,String JavaDoc version,String JavaDoc pDefId) throws SecurityException JavaDoc {
109       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
110          if (!adminUsers.contains(userId)) {
111             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to change process manager state!");
112          }
113       }
114    }
115
116    public void check_processmgr_name (SharkTransaction t,String JavaDoc name,String JavaDoc userId,String JavaDoc pkgId,String JavaDoc version,String JavaDoc pDefId) throws SecurityException JavaDoc {
117
118    }
119
120    public void check_processmgr_description (SharkTransaction t,String JavaDoc name,String JavaDoc userId,String JavaDoc pkgId,String JavaDoc version,String JavaDoc pDefId) throws SecurityException JavaDoc {
121
122    }
123
124    public void check_processmgr_category (SharkTransaction t,String JavaDoc name,String JavaDoc userId,String JavaDoc pkgId,String JavaDoc version,String JavaDoc pDefId) throws SecurityException JavaDoc {
125
126    }
127
128    public void check_processmgr_version (SharkTransaction t,String JavaDoc name,String JavaDoc userId,String JavaDoc pkgId,String JavaDoc version,String JavaDoc pDefId) throws SecurityException JavaDoc {
129
130    }
131
132    public void check_processmgr_context_signature (SharkTransaction t,String JavaDoc name,String JavaDoc userId,String JavaDoc pkgId,String JavaDoc version,String JavaDoc pDefId) throws SecurityException JavaDoc {
133
134    }
135
136    public void check_processmgr_result_signature (SharkTransaction t,String JavaDoc name,String JavaDoc userId,String JavaDoc pkgId,String JavaDoc version,String JavaDoc pDefId) throws SecurityException JavaDoc {
137
138    }
139
140    public void check_processmgr_create_process (SharkTransaction t,String JavaDoc name,String JavaDoc userId,String JavaDoc pkgId,String JavaDoc version,String JavaDoc pDefId) throws SecurityException JavaDoc {
141       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
142          if (!adminUsers.contains(userId)) {
143             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to create processes!");
144          }
145       }
146    }
147
148
149    // WfProcess security methods
150

151    // from WfExecutionObject
152
public void check_process_workflow_state (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
153
154    }
155
156    public void check_process_while_open (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
157
158    }
159
160    public void check_process_why_not_running (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
161
162    }
163
164    public void check_process_how_closed (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
165
166    }
167
168    public void check_process_valid_states (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
169
170    }
171
172    public void check_process_state (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
173
174    }
175
176    public void check_process_change_state (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc curState,String JavaDoc new_state) throws SecurityException JavaDoc {
177       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
178          if (!adminUsers.contains(userId)) {
179             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to change process state!");
180          }
181       }
182    }
183
184    public void check_process_name (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
185
186    }
187
188    public void check_process_set_name (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
189       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
190          if (!adminUsers.contains(userId)) {
191             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to change process name!");
192          }
193       }
194    }
195
196    public void check_process_key (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
197
198    }
199
200    public void check_process_description (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
201
202    }
203
204    public void check_process_set_description (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
205       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
206          if (!adminUsers.contains(userId)) {
207             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to change process description!");
208          }
209       }
210    }
211
212    public void check_process_process_context (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
213       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
214          if (!adminUsers.contains(userId)) {
215             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for process context!");
216          }
217       }
218    }
219
220    public void check_process_set_process_context (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
221       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
222          if (!adminUsers.contains(userId)) {
223             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to change process context!");
224          }
225       }
226    }
227
228    public void check_process_priority (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
229
230    }
231
232    public void check_process_set_priority (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
233       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
234          if (!adminUsers.contains(userId)) {
235             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to change process priority!");
236          }
237       }
238    }
239
240    public void check_process_resume (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
241       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
242          if (!adminUsers.contains(userId)) {
243             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to resume process!");
244          }
245       }
246    }
247
248    public void check_process_suspend (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
249       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
250          if (!adminUsers.contains(userId)) {
251             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to suspend process!");
252          }
253       }
254    }
255
256    public void check_process_terminate (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
257       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
258          if (!adminUsers.contains(userId)) {
259             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to terminate process!");
260          }
261       }
262    }
263
264    public void check_process_abort (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
265       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
266          if (!adminUsers.contains(userId)) {
267             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to abort process!");
268          }
269       }
270    }
271
272    public void check_process_how_many_history (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
273
274    }
275
276    public void check_process_get_iterator_history (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
277       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
278          if (!adminUsers.contains(userId)) {
279             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for iterator over process history!");
280          }
281       }
282    }
283
284    public void check_process_get_sequence_history (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
285       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
286          if (!adminUsers.contains(userId)) {
287             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for process history!");
288          }
289       }
290    }
291
292    public void check_process_is_member_of_history (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
293
294    }
295
296    public void check_process_last_state_time (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
297
298    }
299
300    // from WfProcess
301
public void check_process_requester (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
302       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
303          if (!adminUsers.contains(userId)) {
304             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for process requester!");
305          }
306       }
307    }
308
309    public void check_process_set_requester (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
310       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
311          if (!adminUsers.contains(userId)) {
312             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to change process requester!");
313          }
314       }
315    }
316
317    public void check_process_how_many_step (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
318
319    }
320
321    public void check_process_get_iterator_step (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
322       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
323          if (!adminUsers.contains(userId)) {
324             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for iterator over process activities!");
325          }
326       }
327    }
328
329    public void check_process_get_sequence_step (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
330       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
331          if (!adminUsers.contains(userId)) {
332             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for process steps!");
333          }
334       }
335    }
336
337    public void check_process_is_member_of_step (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
338
339    }
340
341    public void check_process_manager (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
342
343    }
344
345    public void check_process_result (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
346       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
347          if (!adminUsers.contains(userId)) {
348             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for process result!");
349          }
350       }
351    }
352
353    public void check_process_start (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
354       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
355          if (!adminUsers.contains(userId)) {
356             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to start the process!");
357          }
358       }
359    }
360
361    public void check_process_get_activities_in_state (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
362       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
363          if (!adminUsers.contains(userId)) {
364             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for process activities that are in certain state!");
365          }
366       }
367    }
368
369
370    // WfActivity security methods
371

372    // from WfExecutionObject
373
public void check_activity_workflow_state (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
374
375    }
376
377    public void check_activity_while_open (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
378
379    }
380
381    public void check_activity_why_not_running (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
382
383    }
384
385    public void check_activity_how_closed (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
386
387    }
388
389    public void check_activity_valid_states (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
390
391    }
392
393    public void check_activity_state (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
394
395    }
396
397    public void check_activity_change_state (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners,String JavaDoc curState,String JavaDoc new_state) throws SecurityException JavaDoc {
398       if (SECURITY_MODE>=SECURITY_MODE_NUM_NORMAL_SECURITY) {
399          if (new_state.equals("closed.aborted")) {
400             check_activity_abort(t,procId,actId,userId,procCreator,ownerId,possibleOwners);
401          } else if (new_state.equals("closed.completed")) {
402             check_activity_complete(t,procId,actId,userId,procCreator,ownerId,possibleOwners);
403          } else if (new_state.equals("closed.terminated")) {
404             check_activity_terminate(t,procId,actId,userId,procCreator,ownerId,possibleOwners);
405          } else if (new_state.equals("open.not_running.not_started")) {
406             if (!userId.equals(ownerId) && !adminUsers.contains(userId)) {
407                throw new SecurityException JavaDoc("StandardSecurityManager -> NORMAL SECURITY RESTRICTION: Current activity state is "+curState+" - user "+userId+" can't change it to state "+new_state+". Only the owner or admin users are allowed to do it!");
408             }
409          } else if (new_state.equals("open.not_running.suspended")) {
410             check_activity_suspend(t,procId,actId,userId,procCreator,ownerId,possibleOwners);
411          } else { //new state is open.running
412
if (curState.equals("open.not_running.not_started")) {
413                if (!possibleOwners.contains(userId) && !adminUsers.contains(userId)) {
414                   throw new SecurityException JavaDoc("StandardSecurityManager -> NORMAL SECURITY RESTRICTION: Current activity state is "+curState+" - user "+userId+" can't change it to state "+new_state+". Only the owner or admin users are allowed to do it!");
415                }
416             }
417          }
418       }
419    }
420
421    public void check_activity_name (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
422
423    }
424
425    public void check_activity_set_name (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
426       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
427          if (!adminUsers.contains(userId)) {
428             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to change activity name!");
429          }
430       }
431    }
432
433    public void check_activity_key (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
434
435    }
436
437    public void check_activity_description (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
438
439    }
440
441    public void check_activity_set_description (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
442       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
443          if (!adminUsers.contains(userId)) {
444             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to change activity description!");
445          }
446       }
447    }
448
449    public void check_activity_process_context (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
450       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
451          if (!adminUsers.contains(userId)) {
452             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for activity context!");
453          }
454       }
455    }
456
457    public void check_activity_set_process_context (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
458       if (SECURITY_MODE>=SECURITY_MODE_NUM_NORMAL_SECURITY) {
459          if (!userId.equals(ownerId) && !adminUsers.contains(userId)) {
460             throw new SecurityException JavaDoc("StandardSecurityManager -> NORMAL SECURITY RESTRICTION: Only the owner or admin users are allowed to set context of an activity!");
461          }
462       }
463    }
464
465    public void check_activity_priority (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
466
467    }
468
469    public void check_activity_set_priority (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
470       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
471          if (!adminUsers.contains(userId)) {
472             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to change activity priority!");
473          }
474       }
475    }
476
477    public void check_activity_resume (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
478       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
479          if (!adminUsers.contains(userId)) {
480             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to resume an activity!");
481          }
482       }
483    }
484
485    public void check_activity_suspend (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
486       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
487          if (!adminUsers.contains(userId)) {
488             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to suspend an activity!");
489          }
490       }
491    }
492
493    public void check_activity_terminate (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
494       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
495          if (!adminUsers.contains(userId)) {
496             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to terminate an activity!");
497          }
498       }
499    }
500
501    public void check_activity_abort (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
502       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
503          if (!adminUsers.contains(userId)) {
504             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to abort an activity!");
505          }
506       }
507    }
508
509    public void check_activity_how_many_history (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
510
511    }
512
513    public void check_activity_get_iterator_history (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
514       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
515          if (!adminUsers.contains(userId)) {
516             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for iterator over activity's history!");
517          }
518       }
519    }
520
521    public void check_activity_get_sequence_history (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
522       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
523          if (!adminUsers.contains(userId)) {
524             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for a list of activity's history!");
525          }
526       }
527    }
528
529    public void check_activity_is_member_of_history (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
530
531    }
532
533    public void check_activity_last_state_time (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
534
535    }
536
537    // from WfRequester
538
public void check_activity_how_many_performer(SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
539
540    }
541
542    public void check_activity_get_iterator_performer(SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
543       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
544          if (!adminUsers.contains(userId)) {
545             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for iterator over activity's performers!");
546          }
547       }
548    }
549
550    public void check_activity_get_sequence_performer(SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
551       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
552          if (!adminUsers.contains(userId)) {
553             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for a list of performers!");
554          }
555       }
556    }
557
558    public void check_activity_is_member_of_performer(SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
559
560    }
561
562    public void check_activity_receive_event(SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
563
564    }
565
566    // from WfActivity
567
public void check_activity_how_many_assignment (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
568
569    }
570
571    public void check_activity_get_iterator_assignment (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
572       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
573          if (!adminUsers.contains(userId)) {
574             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for iterator over activity's assignments!");
575          }
576       }
577    }
578
579    public void check_activity_get_sequence_assignment (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
580       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
581          if (!adminUsers.contains(userId)) {
582             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for a list of activity's assignments!");
583          }
584       }
585    }
586
587    public void check_activity_is_member_of_assignment (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
588
589    }
590
591    public void check_activity_container (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
592
593    }
594
595    public void check_activity_result (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
596       if (SECURITY_MODE==SECURITY_MODE_NUM_NORMAL_SECURITY) {
597          if (!userId.equals(ownerId) && !adminUsers.contains(userId)) {
598             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: The activity's result can be obtained only by the user that owns it, or by the admin users!");
599          }
600       }
601    }
602
603    public void check_activity_set_result (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
604       if (SECURITY_MODE>=SECURITY_MODE_NUM_NORMAL_SECURITY) {
605          if (!userId.equals(ownerId) && !adminUsers.contains(userId)) {
606             throw new SecurityException JavaDoc("StandardSecurityManager -> NORMAL SECURITY RESTRICTION: The activity's result can be set only by the user that owns it, or by the admin users");
607          }
608       }
609    }
610
611    public void check_activity_complete (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
612       if (SECURITY_MODE>=SECURITY_MODE_NUM_NORMAL_SECURITY) {
613          if (!userId.equals(ownerId) && !adminUsers.contains(userId)) {
614             throw new SecurityException JavaDoc("StandardSecurityManager -> NORMAL SECURITY RESTRICTION: The activity can be completed only by the user that accepted its assignment or by the admin users!");
615          }
616       }
617    }
618
619
620    // WfAssignment security methods
621
public void check_assignment_activity (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc username,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
622
623    }
624
625    public void check_assignment_assignee (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc username,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
626
627    }
628
629    public void check_assignment_set_assignee (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc username,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
630       if (SECURITY_MODE==SECURITY_MODE_NUM_NORMAL_SECURITY) {
631          if (ownerId!=null && !userId.equals(ownerId)) {
632             throw new SecurityException JavaDoc("StandardSecurityManager -> NORMAL SECURITY RESTRICTION: If assignment is accepted, it can be reassigned only by the user that accepted it, or by the admin users");
633          }
634       }
635       if (SECURITY_MODE>SECURITY_MODE_NUM_NORMAL_SECURITY) {
636          if (!userId.equals(ownerId) && !adminUsers.contains(userId)) {
637             throw new SecurityException JavaDoc("StandardSecurityManager -> NORMAL SECURITY RESTRICTION: Only the owner or admin users are allowed to change assignment's status!");
638          }
639       }
640
641    }
642
643    public void check_assignment_set_accepted_status (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc username,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
644       if (SECURITY_MODE>=SECURITY_MODE_NUM_NORMAL_SECURITY) {
645          if (!userId.equals(username) && !adminUsers.contains(userId)) {
646             throw new SecurityException JavaDoc("StandardSecurityManager -> NORMAL SECURITY RESTRICTION: Only the owner or admin users are allowed to change assignment's status!");
647          }
648       }
649    }
650
651    public void check_assignment_get_accepted_status (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc username,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
652
653    }
654
655
656    // WfResource security methods
657
public void check_resource_how_many_work_item (SharkTransaction t,String JavaDoc resourceId,String JavaDoc userId) throws SecurityException JavaDoc {
658
659    }
660
661    public void check_resource_get_iterator_work_item (SharkTransaction t,String JavaDoc resourceId,String JavaDoc userId) throws SecurityException JavaDoc {
662       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
663          if (!adminUsers.contains(userId)) {
664             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for iterator over resource's assignments!");
665          }
666       }
667    }
668
669    public void check_resource_get_sequence_work_item (SharkTransaction t,String JavaDoc resourceId,String JavaDoc userId) throws SecurityException JavaDoc {
670       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
671          if (!adminUsers.contains(userId)) {
672             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for the list of resource's assignments!");
673          }
674       }
675    }
676
677    public void check_resource_is_member_of_work_items (SharkTransaction t,String JavaDoc resourceId,String JavaDoc userId) throws SecurityException JavaDoc {
678
679    }
680
681    public void check_resource_resource_key (SharkTransaction t,String JavaDoc resourceId,String JavaDoc userId) throws SecurityException JavaDoc {
682
683    }
684
685    public void check_resource_resource_name (SharkTransaction t,String JavaDoc resourceId,String JavaDoc userId) throws SecurityException JavaDoc {
686
687    }
688
689    public void check_resource_release (SharkTransaction t,String JavaDoc resourceId,String JavaDoc userId) throws SecurityException JavaDoc {
690       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
691          if (!adminUsers.contains(userId)) {
692             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to release resource's assignment!");
693          }
694       }
695    }
696
697    // WfRequester security methods
698
public void check_requester_how_many_performer (SharkTransaction t,String JavaDoc requesterResourceUsername,String JavaDoc userId) throws SecurityException JavaDoc {
699
700    }
701
702    public void check_requester_get_iterator_performer (SharkTransaction t,String JavaDoc requesterResourceUsername,String JavaDoc userId) throws SecurityException JavaDoc {
703       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
704          if (!adminUsers.contains(userId)) {
705             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to ask for iterator over requester's performers!");
706          }
707       }
708    }
709
710    public void check_requester_get_sequence_performer (SharkTransaction t,String JavaDoc requesterResourceUsername,String JavaDoc userId) throws SecurityException JavaDoc {
711       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
712          if (!adminUsers.contains(userId)) {
713             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to get performer list!");
714          }
715       }
716    }
717
718    public void check_requester_is_member_of_performer (SharkTransaction t,String JavaDoc requesterResourceUsername,String JavaDoc userId) throws SecurityException JavaDoc {
719
720    }
721
722    public void check_requester_receive_event (SharkTransaction t,String JavaDoc requesterResourceUsername,String JavaDoc userId) throws SecurityException JavaDoc {
723
724    }
725
726    // SharkConnection security methods
727
public void check_sharkconnection_connect (SharkTransaction t,String JavaDoc userId) throws SecurityException JavaDoc {
728
729    }
730
731    public void check_sharkconnection_getResourceObject (SharkTransaction t,String JavaDoc userId) throws SecurityException JavaDoc {
732
733    }
734
735    public void check_sharkconnection_createProcess (SharkTransaction t,String JavaDoc pmgrname,String JavaDoc userId,String JavaDoc pkgId,String JavaDoc version,String JavaDoc pDefId) throws SecurityException JavaDoc {
736       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
737          if (!adminUsers.contains(userId)) {
738             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to create process!");
739          }
740       }
741    }
742
743
744    // ExecutionAdministration security methods
745
public void check_executionadministration_connect (SharkTransaction t,String JavaDoc userId) throws SecurityException JavaDoc {
746       if (SECURITY_MODE==SECURITY_MODE_NUM_ADMIN_SECURITY) {
747          if (!adminUsers.contains(userId)) {
748             throw new SecurityException JavaDoc("StandardSecurityManager -> ADMIN SECURITY RESTRICTION: Only admin users are allowed to use ExecutionAdministration interface !");
749          }
750       }
751    }
752
753    public void check_executionadministration_get_iterator_processmgr (SharkTransaction t,String JavaDoc userId) throws SecurityException JavaDoc {
754    }
755
756    public void check_executionadministration_get_sequence_processmgr (SharkTransaction t,String JavaDoc userId) throws SecurityException JavaDoc {
757    }
758
759    public void check_executionadministration_getLoggedUsers (SharkTransaction t,String JavaDoc userId) throws SecurityException JavaDoc {
760    }
761
762    public void check_executionadministration_get_iterator_resource (SharkTransaction t,String JavaDoc userId) throws SecurityException JavaDoc {
763    }
764
765    public void check_executionadministration_get_sequence_resource (SharkTransaction t,String JavaDoc userId) throws SecurityException JavaDoc {
766    }
767
768    public void check_executionadministration_startActivity (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
769    }
770
771    public void check_executionadministration_getProcessMgr (SharkTransaction t,String JavaDoc userId,String JavaDoc name) throws SecurityException JavaDoc {
772    }
773
774    public void check_executionadministration_getResource (SharkTransaction t,String JavaDoc username,String JavaDoc userId) throws SecurityException JavaDoc {
775    }
776
777    public void check_executionadministration_getProcess (SharkTransaction t,String JavaDoc procId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
778    }
779
780    public void check_executionadministration_getActivity (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
781    }
782
783    public void check_executionadministration_getAssignment (SharkTransaction t,String JavaDoc procId,String JavaDoc actId,String JavaDoc username,String JavaDoc userId,String JavaDoc procCreator,String JavaDoc ownerId,List possibleOwners) throws SecurityException JavaDoc {
784    }
785
786    public void check_executionadministration_getAssignment (SharkTransaction t,String JavaDoc procId,String JavaDoc assId,String JavaDoc userId,String JavaDoc procCreator) throws SecurityException JavaDoc {
787    }
788
789    public void check_executionadministration_reevaluateAssignments (SharkTransaction t,String JavaDoc userId) throws SecurityException JavaDoc {
790    }
791
792    public void check_executionadministration_deleteClosedProcesses (SharkTransaction t,String JavaDoc userId) throws SecurityException JavaDoc {
793    }
794
795    // DeadlineAdministration security methods
796
public void check_deadlines (SharkTransaction t,String JavaDoc userId) throws SecurityException JavaDoc {
797    }
798    
799 }
800
Popular Tags