Skip to content

Commit

Permalink
Fix 1144 Feature info allowed options should be a whitelist (#1412)
Browse files Browse the repository at this point in the history
* Replaced exclude options with include options on GetFeatureInfo WMS

* Removed exclude and include options from localConfig
  • Loading branch information
allyoucanmap authored and offtherailz committed Jan 30, 2017
1 parent e908ce2 commit d70b92b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 50 deletions.
13 changes: 9 additions & 4 deletions web/client/components/data/identify/Identify.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const Identify = React.createClass({
changeMousePointer: React.PropTypes.func,
maxItems: React.PropTypes.number,
excludeParams: React.PropTypes.array,
excludeOptions: React.PropTypes.array,
includeOptions: React.PropTypes.array,
showRevGeocode: React.PropTypes.func,
hideRevGeocode: React.PropTypes.func,
showModalReverse: React.PropTypes.bool,
Expand Down Expand Up @@ -99,7 +99,12 @@ const Identify = React.createClass({
layers: [],
maxItems: 10,
excludeParams: ["SLD_BODY"],
excludeOptions: ["origin"],
includeOptions: [
"buffer",
"cql_filter",
"filter",
"propertyName"
],
panelClassName: "panel default-panel",
headerClassName: "panel-heading",
bodyClassName: "panel-body",
Expand Down Expand Up @@ -227,10 +232,10 @@ const Identify = React.createClass({
return false;
},
filterRequestParams(layer) {
let excludeOpt = this.props.excludeOptions || [];
let includeOpt = this.props.includeOptions || [];
let excludeList = this.props.excludeParams || [];
let options = Object.keys(layer).reduce((op, next) => {
if (next !== "params" && excludeOpt.indexOf(next) === -1) {
if (next !== "params" && includeOpt.indexOf(next) !== -1) {
op[next] = layer[next];
}else if (next === "params" && excludeList.length > 0) {
let params = layer[next];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ describe('Identify', () => {
const identify = ReactDOM.render(
<Identify
excludeParams={["ONLY_GETMAP"]}
excludeOptions={["INTERNAL_OPTION"]}
includeOptions={["WMS_PARAMETER_TO_SHARE", "WMS_OPTION"]}
enableRevGeocode={true}
queryableLayersFilter={() => true}
point={{latlng: {lat: 40, lng: 10}}}
Expand Down
8 changes: 1 addition & 7 deletions web/client/examples/styler/localConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@
"className": "square-button",
"closeGlyph": "1-close",
"enableRevGeocode": true,
"excludeOptions": [
"legend",
"statistics",
"columnDefs",
"advancedFilter"
],
"glyph": "map-marker",
"headerClassName": "modal-header",
"headerGlyph": "",
Expand Down Expand Up @@ -95,4 +89,4 @@
"printUrl": "http://demo.geo-solutions.it/geoserver/pdf/info.json",
"proxyUrl": "/mapstore/proxy/?url=",
"translationsPath": "../../translations"
}
}
39 changes: 1 addition & 38 deletions web/client/localConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,25 +281,7 @@
"continuous": false
},
"collapsible": false
},
"excludeOptions": [
"search",
"links",
"allowedSRS",
"title",
"type",
"visibility",
"params",
"legend",
"statistics",
"columnDefs",
"advancedFilter",
"boundingBox",
"capabilities",
"describeCoverage",
"describeLayer",
"loading"
]
}
}
},
"MadeWithLove",
Expand Down Expand Up @@ -618,25 +600,6 @@
"maxHeight": "70%",
"marginBottom": 0
},
"excludeOptions": [
"search",
"links",
"allowedSRS",
"title",
"type",
"visibility",
"params",
"legend",
"statistics",
"columnDefs",
"advancedFilter",
"boundingBox",
"capabilities",
"describeCoverage",
"describeLayer",
"loading"

],
"draggable": false,
"collapsible": true,
"viewerOptions": {
Expand Down

0 comments on commit d70b92b

Please sign in to comment.