View Javadoc
1   /*
2    * Copyright 2009 The Kuali Foundation.
3    *
4    * Licensed under the Educational Community License, Version 1.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl1.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.sec;
17  
18  import java.util.HashMap;
19  import java.util.Map;
20  
21  import org.kuali.ole.coa.businessobject.Account;
22  import org.kuali.ole.coa.businessobject.Chart;
23  import org.kuali.ole.coa.businessobject.ObjectCode;
24  import org.kuali.ole.coa.businessobject.ObjectConsolidation;
25  import org.kuali.ole.coa.businessobject.ObjectLevel;
26  import org.kuali.ole.coa.businessobject.Organization;
27  import org.kuali.ole.coa.businessobject.ProjectCode;
28  import org.kuali.ole.coa.businessobject.SubAccount;
29  import org.kuali.ole.coa.businessobject.SubObjectCode;
30  import org.kuali.ole.sec.businessobject.SecurityAttributeMetadata;
31  import org.kuali.ole.sys.OLEConstants;
32  import org.kuali.ole.sys.OLEPropertyConstants;
33  import org.kuali.rice.coreservice.framework.parameter.ParameterConstants;
34  
35  
36  /**
37   * General Constants for Access Security Module
38   */
39  public class SecConstants {
40  
41      public final static String ACCESS_SECURITY_NAMESPACE_CODE = OLEConstants.CoreModuleNamespaces.ACCESS_SECURITY;
42  
43      public final static String ACCESS_SECURITY_MODULE_ENABLED_PROPERTY_NAME = "module.access.security.enabled";
44  
45      public final static String ACCOUNTING_GROUP_ERROR_KEY_PREFIX = "SecurityGroupErrors:";
46      public final static String ALL_DOCUMENT_TYPE_NAME = OLEConstants.ROOT_DOCUMENT_TYPE;
47      public final static String ALL_PARAMETER_DETAIL_COMPONENT = ParameterConstants.ALL_COMPONENT;
48      public final static String SECURITY_DEFINITION_ID_SEQUENCE_NAME = "SEC_SCRTY_DEFN_ID_SEQ";
49      public final static String SECURITY_MODEL_ID_SEQUENCE_NAME = "SEC_SCRTY_MDL_ID_SEQ";
50      public final static String ACCESS_DENIED_ERROR_FORWARD = "accessDeniedError";
51      public final static String OPEN_DOCUMENT_SECURITY_ACCESS_DENIED_ERROR_KEY = "openDocumentSecurityAccessDeniedError";
52      public final static String ACCESS_ERROR_STRING_REQUEST_KEY = "securityAccessErrorMessage";
53  
54      public final static Map<String, SecurityAttributeMetadata> SECURITY_ATTRIBUTE_METADATA_MAP = new HashMap<String, SecurityAttributeMetadata>();
55      static {
56          SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.ACCOUNT, new SecurityAttributeMetadata(Account.class, OLEPropertyConstants.ACCOUNT_NUMBER));
57          SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.CHART, new SecurityAttributeMetadata(Chart.class, OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE));
58          SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.CHART_DESCEND_HIERARCHY, new SecurityAttributeMetadata(Chart.class, OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE));
59          SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.OBJECT_CONSOLIDATION, new SecurityAttributeMetadata(ObjectConsolidation.class, OLEPropertyConstants.FINANCIAL_CONSOLIDATION_OBJECT_CODE));
60          SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.OBJECT_LEVEL, new SecurityAttributeMetadata(ObjectLevel.class, OLEPropertyConstants.FINANCIAL_OBJECT_LEVEL_CODE));
61          SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.ORGANIZATION, new SecurityAttributeMetadata(Organization.class, OLEPropertyConstants.ORGANIZATION_CODE));
62          SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.ORGANIZATION_DESCEND_HIERARCHY, new SecurityAttributeMetadata(Organization.class, OLEPropertyConstants.ORGANIZATION_CODE));
63          SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.PRINCIPAL_INVESTIGATOR, new SecurityAttributeMetadata(Account.class, OLEPropertyConstants.ACCOUNT_NUMBER));
64          SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.PROJECT_CODE, new SecurityAttributeMetadata(ProjectCode.class, OLEPropertyConstants.CODE));
65          SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.SUB_ACCOUNT, new SecurityAttributeMetadata(SubAccount.class, OLEPropertyConstants.SUB_ACCOUNT_NUMBER));
66      }
67  
68      public final static Map<String, SecurityAttributeMetadata> ATTRIBUTE_SIMULATION_MAP = new HashMap<String, SecurityAttributeMetadata>();
69      static {
70          ATTRIBUTE_SIMULATION_MAP.put(SecurityAttributeNames.ACCOUNT, new SecurityAttributeMetadata(Account.class, OLEPropertyConstants.ACCOUNT_NUMBER, OLEPropertyConstants.ACCOUNT_NAME));
71          ATTRIBUTE_SIMULATION_MAP.put(SecurityAttributeNames.CHART, new SecurityAttributeMetadata(Chart.class, OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE, OLEPropertyConstants.FIN_CHART_OF_ACCOUNT_DESCRIPTION));
72          ATTRIBUTE_SIMULATION_MAP.put(NonSecurityAttributeNames.OBJECT_CODE, new SecurityAttributeMetadata(ObjectCode.class, OLEPropertyConstants.FINANCIAL_OBJECT_CODE, OLEPropertyConstants.FINANCIAL_OBJECT_CODE_NAME));
73          ATTRIBUTE_SIMULATION_MAP.put(SecurityAttributeNames.OBJECT_CONSOLIDATION, new SecurityAttributeMetadata(ObjectConsolidation.class, OLEPropertyConstants.FINANCIAL_CONSOLIDATION_OBJECT_CODE, OLEPropertyConstants.FIN_CONSOLIDATION_OBJECT_NAME));
74          ATTRIBUTE_SIMULATION_MAP.put(SecurityAttributeNames.OBJECT_LEVEL, new SecurityAttributeMetadata(ObjectLevel.class, OLEPropertyConstants.FINANCIAL_OBJECT_LEVEL_CODE, OLEPropertyConstants.FINANCIAL_OBJECT_LEVEL_NAME));
75          ATTRIBUTE_SIMULATION_MAP.put(SecurityAttributeNames.ORGANIZATION, new SecurityAttributeMetadata(Organization.class, OLEPropertyConstants.ORGANIZATION_CODE, OLEPropertyConstants.ORGANIZATION_NAME));
76          ATTRIBUTE_SIMULATION_MAP.put(SecurityAttributeNames.PROJECT_CODE, new SecurityAttributeMetadata(ProjectCode.class, OLEPropertyConstants.CODE, OLEPropertyConstants.NAME));
77          ATTRIBUTE_SIMULATION_MAP.put(SecurityAttributeNames.SUB_ACCOUNT, new SecurityAttributeMetadata(SubAccount.class, OLEPropertyConstants.SUB_ACCOUNT_NUMBER, OLEPropertyConstants.SUB_ACCOUNT_NAME));
78          ATTRIBUTE_SIMULATION_MAP.put(NonSecurityAttributeNames.SUB_OBJECT_CODE, new SecurityAttributeMetadata(SubObjectCode.class, OLEPropertyConstants.FINANCIAL_SUB_OBJECT_CODE, OLEPropertyConstants.FINANCIAL_SUB_OBJECT_CODE_NAME));
79      }
80  
81      public class SecurityConstraintCodes {
82          public static final String ALLOWED = "A";
83          public static final String DENIED = "D";
84      }
85  
86      public class SecurityDefinitionOperatorCodes {
87          public static final String EQUAL = "=";
88          public static final String NOT_EQUAL = "<>";
89          public static final String LESS_THAN = "<";
90          public static final String LESS_THAN_EQUAL = "<=";
91          public static final String GREATER_THAN = ">";
92          public static final String GREATER_THAN_EQUAL = ">=";
93      }
94  
95      public class SecurityAttributeNames {
96          public static final String ACCOUNT = "Account";
97          public static final String CHART = "Chart";
98          public static final String CHART_DESCEND_HIERARCHY = "Chart-Descend Hierarchy";
99          public static final String OBJECT_CONSOLIDATION = "Object Consolidation";
100         public static final String OBJECT_LEVEL = "Object Level";
101         public static final String ORGANIZATION = "Organization";
102         public static final String ORGANIZATION_DESCEND_HIERARCHY = "Organization-Descend Hierarchy";
103         public static final String PRINCIPAL_INVESTIGATOR = "Principal Investigator";
104         public static final String PROJECT_CODE = "Project Code";
105         public static final String SUB_ACCOUNT = "Sub Account";
106     }
107 
108     public class NonSecurityAttributeNames {
109         public static final String OBJECT_CODE = "Object Code";
110         public static final String SUB_OBJECT_CODE = "Sub-Object Code";
111     }
112 
113     public class SecurityParameterNames {
114         public static final String ACCESS_SECURITY_DOCUMENT_TYPES = "ACCESS_SECURITY_DOCUMENT_TYPES";
115         public static final String ENABLE_ACCESS_SECURITY = "ENABLE_ACCESS_SECURITY";
116         public static final String ALWAYS_ALLOW_INITIATOR_DOCUMENT_ACCESS_IND = "ALWAYS_ALLOW_INITIATOR_DOCUMENT_ACCESS_IND";
117         public static final String ALWAYS_ALLOW_INITIATOR_LINE_ACCESS_IND = "ALWAYS_ALLOW_INITIATOR_LINE_ACCESS_IND";
118         public static final String ALWAYS_ALLOW_FISCAL_OFFICER_LINE_ACCESS_IND = "ALWAYS_ALLOW_FISCAL_OFFICER_LINE_ACCESS_IND";
119         public static final String ALWAYS_ALLOW_PRINCIPAL_INVESTIGATOR_LINE_ACCESS_IND = "ALWAYS_ALLOW_PRINCIPAL_INVESTIGATOR_LINE_ACCESS_IND";
120     }
121 
122     public class SecurityTemplateNames {
123         public static final String VIEW_DOCUMENT_FIELD_VALUE = "View Document with Field Value";
124         public static final String VIEW_ACCOUNTING_LINE_FIELD_VALUE = "View Accounting Line with Field Value";
125         public static final String VIEW_NOTES_ATTACHMENTS_FIELD_VALUE = "View Notes/Attachments with Field Value";
126         public static final String EDIT_DOCUMENT_FIELD_VALUE = "Edit Document with Field Value";
127         public static final String EDIT_ACCOUNTING_LINE_FIELD_VALUE = "Edit Accounting Line with Field Value";
128         public static final String LOOKUP_FIELD_VALUE = "Lookup with Field Value";
129         public static final String INQUIRY_FIELD_VALUE = "Balance Inquiry with Field Value";
130     }
131 
132     public class SecurityValueSpecialCharacters {
133         public static final String MULTI_VALUE_SEPERATION_CHARACTER = ";";
134         public static final String WILDCARD_CHARACTER = "*";
135     }
136 }