1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.coa.document.authorization;
17
18 import java.util.Set;
19
20 import org.kuali.ole.coa.businessobject.Account;
21 import org.kuali.ole.sys.OLEConstants;
22 import org.kuali.ole.sys.document.authorization.FinancialSystemMaintenanceDocumentPresentationControllerBase;
23 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
24 import org.kuali.rice.kns.document.MaintenanceDocument;
25 import org.kuali.rice.krad.util.GlobalVariables;
26
27 public class AccountDocumentPresentationController extends FinancialSystemMaintenanceDocumentPresentationControllerBase {
28
29
30 @Override
31 public Set<String> getConditionallyReadOnlyPropertyNames(MaintenanceDocument document) {
32 Set<String> conditionallyReadonlyPropertyNames = super.getConditionallyReadOnlyPropertyNames(document);
33 Account vendor = (Account) document.getNewMaintainableObject().getBusinessObject();
34
35 String nameSpaceCode = OLEConstants.Account.ACCOUNT_NAMESPACE;
36
37 boolean hasPermission = KimApiServiceLocator.getPermissionService().hasPermission(
38 GlobalVariables.getUserSession().getPerson().getPrincipalId(), nameSpaceCode,
39 OLEConstants.Account.ACCOUNT_RESTRICTIONS);
40 boolean hasPermissionVendorFlag = KimApiServiceLocator.getPermissionService().hasPermission(
41 GlobalVariables.getUserSession().getPerson().getPrincipalId(), nameSpaceCode,
42 OLEConstants.Account.ACCOUNT_SUFFICIENT_FUND);
43
44 if (!hasPermission) {
45 conditionallyReadonlyPropertyNames.add(OLEConstants.Account.ACCOUNT_RESTRICTED_STATUS_CD);
46 }
47 if (!hasPermissionVendorFlag) {
48 conditionallyReadonlyPropertyNames.add(OLEConstants.Account.ACCOUNT_SUFFICIENT_FUND_CODE);
49 }
50 return conditionallyReadonlyPropertyNames;
51 }
52
53
54 }