1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.common.rice.authorization; |
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | 0 | public enum PermissionType { |
23 | 0 | INITIATE("Initiate","KR-SYS","Initiate Document"), |
24 | 0 | OPEN("View","KS-SYS","Open Document"), |
25 | 0 | EDIT("Edit","KS-SYS","Edit Document"), |
26 | 0 | ADD_COMMENT("Comment","KS-SYS","Comment on Document"), |
27 | 0 | ADD_ADHOC_REVIEWER("Add Reviewer","KS-SYS","Add Adhoc Reviewer"), |
28 | 0 | WITHDRAW("Withdraw","KS-SYS","Withdraw Document"), |
29 | 0 | SECTION_MAINTENANCE("Section Maintenance","KS-SYS","Section Maintenance"), |
30 | 0 | FIELD_ACCESS("Access Permission","KS-SYS","Access Permission"), |
31 | 0 | SEARCH("Lookup",null,null), |
32 | 0 | REMOVE_ADHOC_REVIEWERS("Remove Reviewers","KS-SYS","Remove Reviewers"), |
33 | 0 | BLANKET_APPROVE("Blanket Approve","KS-SYS","Blanket Approve"), |
34 | 0 | UPLOAD_DOCUMENTS("Upload","KS-SYS","Upload to Document"), |
35 | 0 | KS_ADMIN_SCREEN("KS Admin Screen","KS-SYS","KS Admin Screens"); |
36 | |
|
37 | 0 | private String label = ""; |
38 | 0 | private String permissionNamespace = ""; |
39 | 0 | private String permissionTemplateName = ""; |
40 | |
|
41 | 0 | private PermissionType(String label, String permissionNamespace, String permissionTemplateName) { |
42 | 0 | this.label = label; |
43 | 0 | this.permissionNamespace = permissionNamespace; |
44 | 0 | this.permissionTemplateName = permissionTemplateName; |
45 | 0 | } |
46 | |
|
47 | |
public String getLabel() { |
48 | 0 | return label; |
49 | |
} |
50 | |
|
51 | |
public void setLabel(String label) { |
52 | 0 | this.label = label; |
53 | 0 | } |
54 | |
|
55 | |
public String getPermissionNamespace() { |
56 | 0 | return permissionNamespace; |
57 | |
} |
58 | |
|
59 | |
public void setPermissionNamespace(String permissionNamespace) { |
60 | 0 | this.permissionNamespace = permissionNamespace; |
61 | 0 | } |
62 | |
|
63 | |
public String getPermissionTemplateName() { |
64 | 0 | return permissionTemplateName; |
65 | |
} |
66 | |
|
67 | |
public void setPermissionTemplateName(String permissionTemplateName) { |
68 | 0 | this.permissionTemplateName = permissionTemplateName; |
69 | 0 | } |
70 | |
|
71 | |
public String getCode() { |
72 | 0 | return permissionNamespace + "~" + permissionTemplateName; |
73 | |
} |
74 | |
|
75 | |
public static PermissionType getByCode(String code) { |
76 | 0 | for (PermissionType type : PermissionType.values()) { |
77 | 0 | if (type.getCode().equals(code)) { |
78 | 0 | return type; |
79 | |
} |
80 | |
} |
81 | 0 | return null; |
82 | |
} |
83 | |
|
84 | |
@Override |
85 | |
public String toString() { |
86 | 0 | return label; |
87 | |
} |
88 | |
} |