1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.time.missedpunch.authorization;
17
18 import org.kuali.kpme.tklm.time.missedpunch.MissedPunchDocument;
19 import org.kuali.rice.kim.api.identity.Person;
20 import org.kuali.rice.krad.document.Document;
21 import org.kuali.rice.krad.document.TransactionalDocumentAuthorizerBase;
22
23 public class MissedPunchDocumentAuthorizer extends TransactionalDocumentAuthorizerBase {
24
25 private static final long serialVersionUID = -7136475330057339088L;
26
27 @Override
28 public boolean canEdit(Document document, Person user) {
29 return canApprove(document, user);
30 }
31
32 @Override
33 public boolean canDisapprove(Document document, Person user) {
34 return false;
35 }
36
37 @Override
38 public boolean canSendAdHocRequests(Document document, String actionRequestCd, Person user) {
39 return false;
40 }
41
42 @Override
43 public boolean canApprove(Document document, Person user) {
44 boolean canApprove = super.canApprove(document, user);
45 if(canApprove) {
46 MissedPunchDocument missedPunchDocument = (MissedPunchDocument) document;
47 if(missedPunchDocument.getPrincipalId().equalsIgnoreCase(user.getPrincipalId())) {
48 canApprove = false;
49 }
50 }
51 return canApprove;
52 }
53
54 }