001/*
002 * Copyright 2009 The Kuali Foundation.
003 *
004 * Licensed under the Educational Community License, Version 1.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl1.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.ole.sec;
017
018import java.util.HashMap;
019import java.util.Map;
020
021import org.kuali.ole.coa.businessobject.Account;
022import org.kuali.ole.coa.businessobject.Chart;
023import org.kuali.ole.coa.businessobject.ObjectCode;
024import org.kuali.ole.coa.businessobject.ObjectConsolidation;
025import org.kuali.ole.coa.businessobject.ObjectLevel;
026import org.kuali.ole.coa.businessobject.Organization;
027import org.kuali.ole.coa.businessobject.ProjectCode;
028import org.kuali.ole.coa.businessobject.SubAccount;
029import org.kuali.ole.coa.businessobject.SubObjectCode;
030import org.kuali.ole.sec.businessobject.SecurityAttributeMetadata;
031import org.kuali.ole.sys.OLEConstants;
032import org.kuali.ole.sys.OLEPropertyConstants;
033import org.kuali.rice.coreservice.framework.parameter.ParameterConstants;
034
035
036/**
037 * General Constants for Access Security Module
038 */
039public class SecConstants {
040
041    public final static String ACCESS_SECURITY_NAMESPACE_CODE = OLEConstants.CoreModuleNamespaces.ACCESS_SECURITY;
042
043    public final static String ACCESS_SECURITY_MODULE_ENABLED_PROPERTY_NAME = "module.access.security.enabled";
044
045    public final static String ACCOUNTING_GROUP_ERROR_KEY_PREFIX = "SecurityGroupErrors:";
046    public final static String ALL_DOCUMENT_TYPE_NAME = OLEConstants.ROOT_DOCUMENT_TYPE;
047    public final static String ALL_PARAMETER_DETAIL_COMPONENT = ParameterConstants.ALL_COMPONENT;
048    public final static String SECURITY_DEFINITION_ID_SEQUENCE_NAME = "SEC_SCRTY_DEFN_ID_SEQ";
049    public final static String SECURITY_MODEL_ID_SEQUENCE_NAME = "SEC_SCRTY_MDL_ID_SEQ";
050    public final static String ACCESS_DENIED_ERROR_FORWARD = "accessDeniedError";
051    public final static String OPEN_DOCUMENT_SECURITY_ACCESS_DENIED_ERROR_KEY = "openDocumentSecurityAccessDeniedError";
052    public final static String ACCESS_ERROR_STRING_REQUEST_KEY = "securityAccessErrorMessage";
053
054    public final static Map<String, SecurityAttributeMetadata> SECURITY_ATTRIBUTE_METADATA_MAP = new HashMap<String, SecurityAttributeMetadata>();
055    static {
056        SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.ACCOUNT, new SecurityAttributeMetadata(Account.class, OLEPropertyConstants.ACCOUNT_NUMBER));
057        SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.CHART, new SecurityAttributeMetadata(Chart.class, OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE));
058        SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.CHART_DESCEND_HIERARCHY, new SecurityAttributeMetadata(Chart.class, OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE));
059        SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.OBJECT_CONSOLIDATION, new SecurityAttributeMetadata(ObjectConsolidation.class, OLEPropertyConstants.FINANCIAL_CONSOLIDATION_OBJECT_CODE));
060        SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.OBJECT_LEVEL, new SecurityAttributeMetadata(ObjectLevel.class, OLEPropertyConstants.FINANCIAL_OBJECT_LEVEL_CODE));
061        SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.ORGANIZATION, new SecurityAttributeMetadata(Organization.class, OLEPropertyConstants.ORGANIZATION_CODE));
062        SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.ORGANIZATION_DESCEND_HIERARCHY, new SecurityAttributeMetadata(Organization.class, OLEPropertyConstants.ORGANIZATION_CODE));
063        SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.PRINCIPAL_INVESTIGATOR, new SecurityAttributeMetadata(Account.class, OLEPropertyConstants.ACCOUNT_NUMBER));
064        SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.PROJECT_CODE, new SecurityAttributeMetadata(ProjectCode.class, OLEPropertyConstants.CODE));
065        SECURITY_ATTRIBUTE_METADATA_MAP.put(SecurityAttributeNames.SUB_ACCOUNT, new SecurityAttributeMetadata(SubAccount.class, OLEPropertyConstants.SUB_ACCOUNT_NUMBER));
066    }
067
068    public final static Map<String, SecurityAttributeMetadata> ATTRIBUTE_SIMULATION_MAP = new HashMap<String, SecurityAttributeMetadata>();
069    static {
070        ATTRIBUTE_SIMULATION_MAP.put(SecurityAttributeNames.ACCOUNT, new SecurityAttributeMetadata(Account.class, OLEPropertyConstants.ACCOUNT_NUMBER, OLEPropertyConstants.ACCOUNT_NAME));
071        ATTRIBUTE_SIMULATION_MAP.put(SecurityAttributeNames.CHART, new SecurityAttributeMetadata(Chart.class, OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE, OLEPropertyConstants.FIN_CHART_OF_ACCOUNT_DESCRIPTION));
072        ATTRIBUTE_SIMULATION_MAP.put(NonSecurityAttributeNames.OBJECT_CODE, new SecurityAttributeMetadata(ObjectCode.class, OLEPropertyConstants.FINANCIAL_OBJECT_CODE, OLEPropertyConstants.FINANCIAL_OBJECT_CODE_NAME));
073        ATTRIBUTE_SIMULATION_MAP.put(SecurityAttributeNames.OBJECT_CONSOLIDATION, new SecurityAttributeMetadata(ObjectConsolidation.class, OLEPropertyConstants.FINANCIAL_CONSOLIDATION_OBJECT_CODE, OLEPropertyConstants.FIN_CONSOLIDATION_OBJECT_NAME));
074        ATTRIBUTE_SIMULATION_MAP.put(SecurityAttributeNames.OBJECT_LEVEL, new SecurityAttributeMetadata(ObjectLevel.class, OLEPropertyConstants.FINANCIAL_OBJECT_LEVEL_CODE, OLEPropertyConstants.FINANCIAL_OBJECT_LEVEL_NAME));
075        ATTRIBUTE_SIMULATION_MAP.put(SecurityAttributeNames.ORGANIZATION, new SecurityAttributeMetadata(Organization.class, OLEPropertyConstants.ORGANIZATION_CODE, OLEPropertyConstants.ORGANIZATION_NAME));
076        ATTRIBUTE_SIMULATION_MAP.put(SecurityAttributeNames.PROJECT_CODE, new SecurityAttributeMetadata(ProjectCode.class, OLEPropertyConstants.CODE, OLEPropertyConstants.NAME));
077        ATTRIBUTE_SIMULATION_MAP.put(SecurityAttributeNames.SUB_ACCOUNT, new SecurityAttributeMetadata(SubAccount.class, OLEPropertyConstants.SUB_ACCOUNT_NUMBER, OLEPropertyConstants.SUB_ACCOUNT_NAME));
078        ATTRIBUTE_SIMULATION_MAP.put(NonSecurityAttributeNames.SUB_OBJECT_CODE, new SecurityAttributeMetadata(SubObjectCode.class, OLEPropertyConstants.FINANCIAL_SUB_OBJECT_CODE, OLEPropertyConstants.FINANCIAL_SUB_OBJECT_CODE_NAME));
079    }
080
081    public class SecurityConstraintCodes {
082        public static final String ALLOWED = "A";
083        public static final String DENIED = "D";
084    }
085
086    public class SecurityDefinitionOperatorCodes {
087        public static final String EQUAL = "=";
088        public static final String NOT_EQUAL = "<>";
089        public static final String LESS_THAN = "<";
090        public static final String LESS_THAN_EQUAL = "<=";
091        public static final String GREATER_THAN = ">";
092        public static final String GREATER_THAN_EQUAL = ">=";
093    }
094
095    public class SecurityAttributeNames {
096        public static final String ACCOUNT = "Account";
097        public static final String CHART = "Chart";
098        public static final String CHART_DESCEND_HIERARCHY = "Chart-Descend Hierarchy";
099        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}