Added allowed list of field instead of checking the ones to be rejected

reject
This commit is contained in:
Luca Frosini 2019-10-04 14:16:34 +02:00
parent 68e12bf99a
commit 7322b7d43e
1 changed files with 12 additions and 13 deletions

View File

@ -297,6 +297,9 @@ public class CKANPackage extends CKAN {
} }
} }
protected static String[] allowedFilters = new String[] {"q", "fq", "fq_list", "sort", "facet", "facet.mincount",
"facet.limit", "facet.field", "include_drafts", "include_private", "ext_bbox", "fl"};
protected Map<String,String> checkListParameters(MultivaluedMap<String,String> queryParameters, protected Map<String,String> checkListParameters(MultivaluedMap<String,String> queryParameters,
Map<String,String> parameters) { Map<String,String> parameters) {
@ -332,15 +335,11 @@ public class CKANPackage extends CKAN {
// q=organization:nextnext // q=organization:nextnext
} }
for(String key : queryParameters.keySet()) { for(String key : allowedFilters) {
// if 'rows' and 'start' are provided they replace the values imposed by caller if(queryParameters.containsKey(key)) {
// provided limit and offset parameter which are the gCat interface are not passed to CKAN
if(key.compareTo(GCatConstants.LIMIT_PARAMETER) == 0
|| key.compareTo(GCatConstants.OFFSET_PARAMETER) == 0) {
continue;
}
parameters.put(key, queryParameters.getFirst(key)); parameters.put(key, queryParameters.getFirst(key));
} }
}
// parameters.put(INCLUDE_PRIVATE_KEY, String.valueOf(true)); // parameters.put(INCLUDE_PRIVATE_KEY, String.valueOf(true));