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.businessobject.lookup; 017 018import java.util.List; 019import java.util.Map; 020 021import org.kuali.ole.coa.businessobject.lookup.KualiAccountLookupableHelperServiceImpl; 022import org.kuali.ole.sec.SecKeyConstants; 023import org.kuali.ole.sec.service.AccessSecurityService; 024import org.kuali.ole.sec.util.SecUtil; 025import org.kuali.rice.krad.util.GlobalVariables; 026 027 028/** 029 * Lookupable helper that provides Access Security integration 030 */ 031public class AccessSecurityAccountLookupableHelperServiceImpl extends KualiAccountLookupableHelperServiceImpl { 032 protected AccessSecurityService accessSecurityService; 033 034 /** 035 * Gets search results and passes to access security service to apply access restrictions 036 * 037 * @see org.kuali.rice.kns.lookup.LookupableHelperService#getSearchResults(java.util.Map) 038 */ 039 public List getSearchResults(Map<String, String> fieldValues) { 040 List results = super.getSearchResults(fieldValues); 041 042 int resultSizeBeforeRestrictions = results.size(); 043 accessSecurityService.applySecurityRestrictionsForLookup(results, GlobalVariables.getUserSession().getPerson()); 044 045 accessSecurityService.compareListSizeAndAddMessageIfChanged(resultSizeBeforeRestrictions, results, SecKeyConstants.MESSAGE_LOOKUP_RESULTS_RESTRICTED); 046 047 return results; 048 } 049 050 /** 051 * Gets search results and passes to access security service to apply access restrictions 052 * 053 * @see org.kuali.rice.kns.lookup.LookupableHelperService#getSearchResultsUnbounded(java.util.Map) 054 */ 055 public List getSearchResultsUnbounded(Map<String, String> fieldValues) { 056 List results = super.getSearchResultsUnbounded(fieldValues); 057 058 int resultSizeBeforeRestrictions = results.size(); 059 accessSecurityService.applySecurityRestrictionsForLookup(results, GlobalVariables.getUserSession().getPerson()); 060 061 accessSecurityService.compareListSizeAndAddMessageIfChanged(resultSizeBeforeRestrictions, results, SecKeyConstants.MESSAGE_LOOKUP_RESULTS_RESTRICTED); 062 063 return results; 064 } 065 066 /** 067 * Sets the accessSecurityService attribute value. 068 * 069 * @param accessSecurityService The accessSecurityService to set. 070 */ 071 public void setAccessSecurityService(AccessSecurityService accessSecurityService) { 072 this.accessSecurityService = accessSecurityService; 073 } 074 075}