1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.authorization;
17
18 import java.util.Map;
19
20 import org.kuali.hr.time.roles.TkUserRoles;
21 import org.kuali.rice.kim.api.identity.Person;
22 import org.kuali.rice.krad.bo.BusinessObject;
23 import org.kuali.rice.krad.document.Document;
24 import org.kuali.rice.krad.maintenance.MaintenanceDocument;
25 import org.kuali.rice.krad.util.GlobalVariables;
26
27 public class LocationAdminAuthorizer extends SystemAdminAuthorizer {
28
29 public boolean isLocationAdmin(){
30 return TkUserRoles.getUserRoles(GlobalVariables.getUserSession().getPrincipalId()).isLocationAdmin();
31 }
32
33 @Override
34 public boolean canInitiate(String documentTypeName, Person user) {
35 return super.canInitiate(documentTypeName, user) || isLocationAdmin();
36 }
37
38 @Override
39 public boolean canOpen(Document document, Person user) {
40 return super.canOpen(document, user) || isLocationAdmin();
41 }
42
43 @Override
44 public boolean canReceiveAdHoc(Document document, Person user,
45 String actionRequestCode) {
46 return super.canReceiveAdHoc(document, user, actionRequestCode) || isLocationAdmin();
47 }
48
49 @Override
50 public boolean canAddNoteAttachment(Document document,
51 String attachmentTypeCode, Person user) {
52 return super.canAddNoteAttachment(document, attachmentTypeCode, user) || isLocationAdmin();
53 }
54
55 @Override
56 public boolean canDeleteNoteAttachment(Document document,
57 String attachmentTypeCode, String createdBySelfOnly, Person user) {
58 return super.canDeleteNoteAttachment(document, attachmentTypeCode, createdBySelfOnly, user) || isLocationAdmin();
59 }
60
61 @Override
62 public boolean canViewNoteAttachment(Document document,
63 String attachmentTypeCode, Person user) {
64 return super.canViewNoteAttachment(document, attachmentTypeCode, user) || isLocationAdmin();
65 }
66
67 @Override
68 public boolean canViewNoteAttachment(Document document,
69 String attachmentTypeCode, String authorUniversalIdentifier, Person user) {
70 return super.canViewNoteAttachment(document, attachmentTypeCode, authorUniversalIdentifier, user) || isLocationAdmin();
71 }
72
73 @Override
74 public boolean canSendAdHocRequests(Document document,
75 String actionRequestCd, Person user) {
76 return super.canSendAdHocRequests(document, actionRequestCd, user) || isLocationAdmin();
77 }
78
79 @Override
80 public boolean isAuthorized(BusinessObject businessObject,
81 String namespaceCode, String permissionName, String principalId) {
82 return super.isAuthorized(businessObject, namespaceCode, permissionName, principalId) || isLocationAdmin();
83 }
84
85 @Override
86 public boolean isAuthorizedByTemplate(BusinessObject businessObject,
87 String namespaceCode, String permissionTemplateName,
88 String principalId) {
89 return super.isAuthorizedByTemplate(businessObject, namespaceCode, permissionTemplateName, principalId) || isLocationAdmin();
90 }
91
92 @Override
93 public boolean isAuthorized(BusinessObject businessObject,
94 String namespaceCode, String permissionName, String principalId,
95 Map<String, String> additionalPermissionDetails,
96 Map<String, String> additionalRoleQualifiers) {
97 return super.isAuthorized(businessObject, namespaceCode, permissionName, principalId, additionalPermissionDetails, additionalRoleQualifiers) || isLocationAdmin();
98 }
99
100 @Override
101 public boolean isAuthorizedByTemplate(Object dataObject,
102 String namespaceCode, String permissionTemplateName,
103 String principalId,
104 Map<String, String> additionalPermissionDetails,
105 Map<String, String> additionalRoleQualifiers) {
106 return super.isAuthorizedByTemplate(dataObject, namespaceCode, permissionTemplateName, principalId) || isLocationAdmin();
107 }
108
109 @Override
110 public boolean canCreate(Class boClass, Person user) {
111 return super.canCreate(boClass, user) || isLocationAdmin();
112 }
113
114 @Override
115 public boolean canMaintain(Object dataObject, Person user) {
116 return super.canMaintain(dataObject, user) || isLocationAdmin();
117 }
118
119 @Override
120 public boolean canCreateOrMaintain(MaintenanceDocument maintenanceDocument,
121 Person user) {
122 return super.canCreateOrMaintain(maintenanceDocument, user) || isLocationAdmin();
123 }
124
125 @Override
126 public boolean canEdit(Document document, Person user) {
127 return super.canEdit(document, user) || isLocationAdmin();
128 }
129
130 @Override
131 public boolean canAnnotate(Document document, Person user) {
132 return super.canAnnotate(document, user) || isLocationAdmin();
133 }
134
135 @Override
136 public boolean canReload(Document document, Person user) {
137 return super.canReload(document, user) || isLocationAdmin();
138 }
139
140 @Override
141 public boolean canClose(Document document, Person user) {
142 return super.canClose(document, user) || isLocationAdmin();
143 }
144
145 @Override
146 public boolean canSave(Document document, Person user) {
147 return super.canSave(document, user) || isLocationAdmin();
148 }
149
150 @Override
151 public boolean canRoute(Document document, Person user) {
152 return super.canRoute(document, user) || isLocationAdmin();
153 }
154
155 @Override
156 public boolean canCancel(Document document, Person user) {
157 return super.canCancel(document, user) || isLocationAdmin();
158 }
159
160 @Override
161 public boolean canCopy(Document document, Person user) {
162 return super.canCopy(document, user) || isLocationAdmin();
163 }
164
165 @Override
166 public boolean canPerformRouteReport(Document document, Person user) {
167 return super.canCopy(document, user) || isLocationAdmin();
168 }
169
170 @Override
171 public boolean canBlanketApprove(Document document, Person user) {
172 return super.canBlanketApprove(document, user) || isLocationAdmin();
173 }
174
175 @Override
176 public boolean canApprove(Document document, Person user) {
177 return super.canApprove(document, user) || isLocationAdmin();
178 }
179
180 @Override
181 public boolean canDisapprove(Document document, Person user) {
182 return super.canDisapprove(document, user) || isLocationAdmin();
183 }
184
185 @Override
186 public boolean canSendNoteFyi(Document document, Person user) {
187 return super.canSendNoteFyi(document, user) || isLocationAdmin();
188 }
189
190 @Override
191 public boolean canEditDocumentOverview(Document document, Person user) {
192 return super.canEditDocumentOverview(document, user) || isLocationAdmin();
193 }
194
195 @Override
196 public boolean canFyi(Document document, Person user) {
197 return super.canFyi(document, user) || isLocationAdmin();
198 }
199
200 @Override
201 public boolean canAcknowledge(Document document, Person user) {
202 return super.canAcknowledge(document, user) || isLocationAdmin();
203 }
204
205 @Override
206 public boolean canSendAnyTypeAdHocRequests(Document document, Person user) {
207 return super.canSendAnyTypeAdHocRequests(document, user) || isLocationAdmin();
208 }
209
210 @Override
211 public boolean canTakeRequestedAction(Document document,
212 String actionRequestCode, Person user) {
213 return super.canTakeRequestedAction(document, actionRequestCode, user) || isLocationAdmin();
214 }
215
216 @Override
217 public boolean canRecall(Document document, Person user) {
218 return super.canRecall(document, user) || isLocationAdmin();
219 }
220
221 @Override
222 public boolean isAuthorized(Object dataObject, String namespaceCode,
223 String permissionName, String principalId) {
224 return super.isAuthorized(dataObject, namespaceCode, permissionName, principalId) || isLocationAdmin();
225 }
226
227 @Override
228 public boolean isAuthorizedByTemplate(Object dataObject,
229 String namespaceCode, String permissionTemplateName,
230 String principalId) {
231 return super.isAuthorizedByTemplate(dataObject, namespaceCode, permissionTemplateName, principalId) || isLocationAdmin();
232 }
233
234 @Override
235 public boolean isAuthorized(Object dataObject, String namespaceCode,
236 String permissionTemplateName, String principalId,
237 Map<String, String> additionalPermissionDetails,
238 Map<String, String> additionalRoleQualifiers) {
239 return super.isAuthorizedByTemplate(dataObject, namespaceCode, permissionTemplateName, principalId, additionalPermissionDetails, additionalRoleQualifiers) || isLocationAdmin();
240 }
241
242 }