Fix for security hole I have introduced while working on the Ajax autocompleter fields.
This is a temporary approach that can be improved. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@659658 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.TreeSet;
|
||||
import javolution.util.FastList;
|
||||
import org.ofbiz.entity.condition.EntityConditionList;
|
||||
import org.ofbiz.entity.condition.EntityExpr;
|
||||
import org.ofbiz.entity.condition.EntityFieldValue;
|
||||
import org.ofbiz.entity.condition.EntityFunction;
|
||||
import org.ofbiz.entity.condition.EntityOperator;
|
||||
import org.ofbiz.base.util.UtilMisc;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
|
||||
delegator = request.getAttribute("delegator");
|
||||
|
||||
andExprs = FastList.newInstance();
|
||||
fieldValue = request.getParameter("exampleFeatureId");
|
||||
if (UtilValidate.isNotEmpty(fieldValue)) {
|
||||
andExprs.add(new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("exampleFeatureId")),
|
||||
EntityOperator.LIKE, "%" + fieldValue.toUpperCase() + "%"));
|
||||
}
|
||||
|
||||
List autocompleteOptions = null;
|
||||
if (andExprs.size() > 0) {
|
||||
entityConditionList = new EntityConditionList(andExprs, EntityOperator.AND);
|
||||
autocompleteOptions = delegator.findList("ExampleFeature", entityConditionList, new TreeSet(UtilMisc.toList("exampleFeatureId", "description")), UtilMisc.toList("-exampleFeatureId"), null, false);
|
||||
//context.put("autocompleteOptions", autocompleteOptions);
|
||||
request.setAttribute("autocompleteOptions", autocompleteOptions);
|
||||
}
|
||||
return "success";
|
||||
@@ -28,6 +28,8 @@ under the License.
|
||||
<description>Example Component Site Configuration File</description>
|
||||
<owner>Copyright 2001-2008 The Apache Software Foundation</owner>
|
||||
|
||||
<handler name="bsf" type="request" class="org.ofbiz.webapp.event.BsfEventHandler"/>
|
||||
|
||||
<!--
|
||||
These can be used to return the reports as views; make sure the classes are compiled and available
|
||||
<handler name="datavision" type="view" class="org.ofbiz.webapp.view.DataVisionViewHandler"/>
|
||||
@@ -154,6 +156,12 @@ under the License.
|
||||
<response name="success" type="view" value="EditExampleFeatureExampleAppls"/>
|
||||
<response name="error" type="view" value="EditExampleFeatureExampleAppls"/>
|
||||
</request-map>
|
||||
<request-map uri="findExampleFeatures">
|
||||
<security https="true" auth="true"/>
|
||||
<event type="bsf" path="/WEB-INF/actions/includes/" invoke="findExampleFeatures.bsh"/>
|
||||
<response name="success" type="view" value="ajaxAutocompleteOptions"/>
|
||||
<response name="error" type="view" value="ajaxAutocompleteOptions"/>
|
||||
</request-map>
|
||||
|
||||
<request-map uri="FormWidgetExamples"><security https="true" auth="true"/><response name="success" type="view" value="FormWidgetExamples"/></request-map>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user