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.util; 17 18 import org.kuali.ole.sec.SecConstants; 19 import org.kuali.ole.sec.service.AccessSecurityService; 20 import org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntry; 21 import org.kuali.ole.sys.context.SpringContext; 22 import org.kuali.rice.core.api.config.property.ConfigurationService; 23 import org.kuali.rice.krad.document.Document; 24 import org.kuali.rice.krad.util.GlobalVariables; 25 26 27 public class SecUtil { 28 29 /** 30 * Calls access security service to check view access on given GLPE for current user. Access to view the GLPE on the document should be related to the view permissions for an 31 * accounting line with the same account attributes. Called from generalLedgerPendingEntries.tag 32 * 33 * @param pendingEntry GeneralLedgerPendingEntry to check access for 34 * @return boolean true if current user has view permission, false otherwise 35 */ 36 public static boolean canViewGLPE(Document document, GeneralLedgerPendingEntry pendingEntry) { 37 if (SpringContext.getBean(ConfigurationService.class).getPropertyValueAsBoolean(SecConstants.ACCESS_SECURITY_MODULE_ENABLED_PROPERTY_NAME)) { 38 return SpringContext.getBean(AccessSecurityService.class).canViewGLPE(document, pendingEntry, GlobalVariables.getUserSession().getPerson() ); 39 } 40 return true; // access security isn't on. so that means you can view glpes 41 } 42 }