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.util; 017 018import org.kuali.ole.sec.SecConstants; 019import org.kuali.ole.sec.service.AccessSecurityService; 020import org.kuali.ole.sys.businessobject.GeneralLedgerPendingEntry; 021import org.kuali.ole.sys.context.SpringContext; 022import org.kuali.rice.core.api.config.property.ConfigurationService; 023import org.kuali.rice.krad.document.Document; 024import org.kuali.rice.krad.util.GlobalVariables; 025 026 027public class SecUtil { 028 029 /** 030 * 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 031 * accounting line with the same account attributes. Called from generalLedgerPendingEntries.tag 032 * 033 * @param pendingEntry GeneralLedgerPendingEntry to check access for 034 * @return boolean true if current user has view permission, false otherwise 035 */ 036 public static boolean canViewGLPE(Document document, GeneralLedgerPendingEntry pendingEntry) { 037 if (SpringContext.getBean(ConfigurationService.class).getPropertyValueAsBoolean(SecConstants.ACCESS_SECURITY_MODULE_ENABLED_PROPERTY_NAME)) { 038 return SpringContext.getBean(AccessSecurityService.class).canViewGLPE(document, pendingEntry, GlobalVariables.getUserSession().getPerson() ); 039 } 040 return true; // access security isn't on. so that means you can view glpes 041 } 042}