Skip to content

Commit f83b325

Browse files
author
Adam Collins
committed
Disable biocollect integration
1 parent 3e9a4fe commit f83b325

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

grails-app/assets/javascripts/spApp/controller/leafletMapController.js

+14-11
Original file line numberDiff line numberDiff line change
@@ -679,11 +679,12 @@
679679
}).addTo(map);
680680
}
681681

682-
if ($SH.biocollectUrl) {
683-
new L.Control.Poi({
684-
togglePoi: $scope.togglePoi
685-
}).addTo(map);
686-
}
682+
// does not work with the current biocollect version
683+
// if ($SH.biocollectUrl) {
684+
// new L.Control.Poi({
685+
// togglePoi: $scope.togglePoi
686+
// }).addTo(map);
687+
// }
687688

688689
var measureControl = new L.Control.Measure({
689690
position: 'topleft',
@@ -728,18 +729,20 @@
728729
if (e.target.imagesControl && e.target.imagesControl._images_state) {
729730
$scope.addImagesToMap();
730731
}
731-
if (e.target.poiControl && e.target.poiControl._poi_state) {
732-
$scope.addPoiToMap();
733-
}
732+
// does not work with the current biocollect version
733+
// if (e.target.poiControl && e.target.poiControl._poi_state) {
734+
// $scope.addPoiToMap();
735+
// }
734736
});
735737

736738
map.on('zoomend', function (e) {
737739
if (e.target.imagesControl && e.target.imagesControl._images_state) {
738740
$scope.addImagesToMap();
739741
}
740-
if (e.target.poiControl && e.target.poiControl._poi_state) {
741-
$scope.addPoiToMap();
742-
}
742+
// does not work with the current biocollect version
743+
// if (e.target.poiControl && e.target.poiControl._poi_state) {
744+
// $scope.addPoiToMap();
745+
// }
743746
});
744747

745748
$scope.bounds.southWest.lng = map.getBounds().getWest();

grails-app/controllers/au/org/ala/spatial/portal/BiocollectController.groovy

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package au.org.ala.spatial.portal
22

33
import grails.converters.JSON
4-
import org.apache.http.client.methods.HttpGet
54
import grails.util.Holders
5+
import org.apache.http.entity.ContentType
66

77

88
class BiocollectController {
9-
def hubWebService
9+
def webService
1010
def authService
11-
def allowCalls = ["/nocas/geoService"]
1211
String biocollectUrl = Holders.config.biocollect.url
1312

1413
/**
@@ -20,22 +19,24 @@ class BiocollectController {
2019
if (!authService.userId || !isAllowed(url)) {
2120
notAuthorised()
2221
} else {
23-
def headers = [:]
24-
headers.put ("apiKey",grailsApplication.config.api_key)
25-
def r = hubWebService.urlResponse(HttpGet.METHOD_NAME, url, null, headers)
22+
def r = webService.get(url, [:], ContentType.APPLICATION_JSON, false, true, [:])
2623
return r
2724
}
2825
}
2926

3027
private boolean isAllowed(url) {
3128
if (url.startsWith(biocollectUrl)) {
32-
//url.matches(".*(?i)(Nocas|test).*")
33-
String pattern = ".*(?i)("+ allowCalls.join("|") +").*"
34-
return url.matches(pattern)
29+
// must be one of the allowed URLs
30+
List items = Holders.config.biocollect.areaReport
31+
for (def item : items) {
32+
if (item.count && url.startsWith(item.count.replace("_geoSearchJSON_", ""))) {
33+
return true
34+
}
35+
}
36+
return false;
3537
} else {
3638
return false
3739
}
38-
3940
}
4041

4142
private def notAuthorised() {

0 commit comments

Comments
 (0)