1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krms.impl.authorization;
17
18 import org.kuali.rice.kim.api.identity.Person;
19 import org.kuali.rice.krad.document.MaintenanceDocument;
20 import org.kuali.rice.krad.document.authorization.MaintenanceDocumentAuthorizer;
21 import org.kuali.rice.krad.document.authorization.DocumentAuthorizerBase;
22 import org.kuali.rice.krms.api.KrmsConstants;
23 import org.kuali.rice.krms.impl.repository.AgendaBo;
24 import org.kuali.rice.krms.impl.repository.KrmsRepositoryServiceLocator;
25 import org.kuali.rice.krms.impl.ui.AgendaEditor;
26
27 import java.util.HashSet;
28 import java.util.Set;
29
30 public class AgendaEditorAuthorizer extends DocumentAuthorizerBase implements MaintenanceDocumentAuthorizer {
31
32 @Override
33 public boolean canCreate(Class boClass, Person user) {
34 return getAgendaAuthorizationService().isAuthorized(KrmsConstants.MAINTAIN_KRMS_AGENDA, null);
35 }
36
37 @Override
38 public boolean canMaintain(Object dataObject, Person user) {
39 AgendaEditor agendaEditor = (AgendaEditor) dataObject;
40 return getAgendaAuthorizationService().isAuthorized(KrmsConstants.MAINTAIN_KRMS_AGENDA, agendaEditor.getAgenda().getContextId());
41 }
42
43 @Override
44 public boolean canCreateOrMaintain(MaintenanceDocument maintenanceDocument, Person user) {
45 AgendaEditor agendaEditor = (AgendaEditor) maintenanceDocument.getOldMaintainableObject().getDataObject();
46 return getAgendaAuthorizationService().isAuthorized(KrmsConstants.MAINTAIN_KRMS_AGENDA, agendaEditor.getAgenda().getContextId());
47 }
48
49 @Override
50 public Set<String> getSecurePotentiallyReadOnlySectionIds() {
51 return new HashSet<String>();
52 }
53
54 @Override
55 public Set<String> getSecurePotentiallyHiddenSectionIds() {
56 return new HashSet<String>();
57 }
58
59 private AgendaAuthorizationService getAgendaAuthorizationService() {
60 return KrmsRepositoryServiceLocator.getAgendaAuthorizationService();
61 }
62 }