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 | |
|
23 | |
|
24 | 0 | public enum PermissionType { |
25 | 0 | INITIATE("Initiate","KR-SYS","Initiate Document"), |
26 | 0 | OPEN("View","KS-SYS","Open Document"), |
27 | 0 | EDIT("Edit","KS-SYS","Edit Document"), |
28 | 0 | ADD_COMMENT("Comment","KS-SYS","Comment on Document"), |
29 | 0 | ADD_ADHOC_REVIEWER("Add Reviewer","KS-SYS","Add Adhoc Reviewer"), |
30 | 0 | WITHDRAW("Withdraw","KS-SYS","Withdraw Document"), |
31 | 0 | SECTION_MAINTENANCE("Section Maintenance","KS-SYS","Section Maintenance"), |
32 | 0 | FIELD_ACCESS("Access Permission","KS-SYS","Access Permission"), |
33 | 0 | SEARCH("Lookup",null,null), |
34 | 0 | REMOVE_ADHOC_REVIEWERS("Remove Reviewers","KS-SYS","Remove Reviewers"), |
35 | 0 | BLANKET_APPROVE("Blanket Approve","KS-SYS","Blanket Approve"), |
36 | 0 | UPLOAD_DOCUMENTS("Upload","KS-SYS","Upload to Document"), |
37 | 0 | USE_SCREEN("Use Screen","KS-SYS","Use Screen"), |
38 | 0 | ADD_COLLABORATOR_ACTION("Add Collaborator Action","KS-SYS","Add Collaborator Action"); |
39 | |
|
40 | 0 | private String label = ""; |
41 | 0 | private String permissionNamespace = ""; |
42 | 0 | private String permissionTemplateName = ""; |
43 | |
|
44 | 0 | private PermissionType(String label, String permissionNamespace, String permissionTemplateName) { |
45 | 0 | this.label = label; |
46 | 0 | this.permissionNamespace = permissionNamespace; |
47 | 0 | this.permissionTemplateName = permissionTemplateName; |
48 | 0 | } |
49 | |
|
50 | |
public String getLabel() { |
51 | 0 | return label; |
52 | |
} |
53 | |
|
54 | |
public void setLabel(String label) { |
55 | 0 | this.label = label; |
56 | 0 | } |
57 | |
|
58 | |
public String getPermissionNamespace() { |
59 | 0 | return permissionNamespace; |
60 | |
} |
61 | |
|
62 | |
public void setPermissionNamespace(String permissionNamespace) { |
63 | 0 | this.permissionNamespace = permissionNamespace; |
64 | 0 | } |
65 | |
|
66 | |
public String getPermissionTemplateName() { |
67 | 0 | return permissionTemplateName; |
68 | |
} |
69 | |
|
70 | |
public void setPermissionTemplateName(String permissionTemplateName) { |
71 | 0 | this.permissionTemplateName = permissionTemplateName; |
72 | 0 | } |
73 | |
|
74 | |
public String getCode() { |
75 | 0 | return permissionNamespace + "~" + permissionTemplateName; |
76 | |
} |
77 | |
|
78 | |
public static PermissionType getByCode(String code) { |
79 | 0 | for (PermissionType type : PermissionType.values()) { |
80 | 0 | if (type.getCode().equals(code)) { |
81 | 0 | return type; |
82 | |
} |
83 | |
} |
84 | 0 | return null; |
85 | |
} |
86 | |
|
87 | |
@Override |
88 | |
public String toString() { |
89 | 0 | return label; |
90 | |
} |
91 | |
} |