Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,15 @@ public class FeatureRequest implements Serializable {

@Schema(description = "Wave buoy name")
private String waveBuoy;

@Schema(description = "Enable or disable geoserver whitelist")
@Builder.Default
private Boolean enableGeoServerWhiteList = Boolean.TRUE;
/**
* Make sure if json indicate null, we still return true by default
* @return - Utility function with default
*/
public Boolean getEnableGeoServerWhiteList() {
return enableGeoServerWhiteList != null ? enableGeoServerWhiteList : Boolean.TRUE;
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package au.org.aodn.ogcapi.server.core.service.wms;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.Set;

@Getter
@Setter
Expand All @@ -22,4 +24,7 @@ public class WmsDefaultParam {
private Map<String, String> ncwms;

private Map<String, String> descLayer;

@JsonProperty("allow-id")
private Set<String> allowId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ public byte[] getMapTile(String collectionId, FeatureRequest request) throws URI
* @return - The fields contained in this WMS layer, we are particular interest in the date time field for subsetting
*/
public List<DownloadableFieldModel> getDownloadableFields(String collectionId, FeatureRequest request) {

DescribeLayerResponse response = this.describeLayer(collectionId, request);

if (response != null && response.getLayerDescription().getWfs() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import au.org.aodn.ogcapi.server.core.service.ElasticSearch;
import au.org.aodn.ogcapi.server.core.service.OGCApiService;
import au.org.aodn.ogcapi.server.core.service.wfs.WfsServer;
import au.org.aodn.ogcapi.server.core.service.wms.WmsDefaultParam;
import au.org.aodn.ogcapi.server.core.service.wms.WmsServer;
import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -40,6 +41,9 @@ public class RestServices extends OGCApiService {
@Autowired
protected WmsServer wmsServer;

@Autowired
protected WmsDefaultParam wmsDefaultParam;

@Override
public List<String> getConformanceDeclaration() {
return List.of("http://www.opengis.net/doc/IS/ogcapi-features-1/1.0.1");
Expand Down Expand Up @@ -113,11 +117,17 @@ public ResponseEntity<?> getWmsDownloadableFields(String collectionId, FeatureRe
return ResponseEntity.badRequest().body("Layer name cannot be null or empty");
}

List<DownloadableFieldModel> result = wmsServer.getDownloadableFields(collectionId, request);
// Temp block and show only white list uuid, the other uuid need QA check before release.
if (request.getEnableGeoServerWhiteList() && wmsDefaultParam.getAllowId() != null && !wmsDefaultParam.getAllowId().contains(collectionId)) {
return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
}
else {
List<DownloadableFieldModel> result = wmsServer.getDownloadableFields(collectionId, request);

return result.isEmpty() ?
ResponseEntity.notFound().build() :
ResponseEntity.ok(result);
return result.isEmpty() ?
ResponseEntity.notFound().build() :
ResponseEntity.ok(result);
}
}

/**
Expand All @@ -136,9 +146,9 @@ public ResponseEntity<?> getWmsLayers(String collectionId, FeatureRequest reques
}

/**
* @param collectionID
* @param from
* @return
* @param collectionID - uuid
* @param from -
* @return -
*/
public ResponseEntity<?> getWaveBuoys(String collectionID, String from) {
if (!dasService.isCollectionSupported(collectionID)) {
Expand Down
Loading
Loading