3939import org .springframework .context .ConfigurableApplicationContext ;
4040import org .springframework .http .HttpStatus ;
4141import org .springframework .http .MediaType ;
42+ import org .springframework .security .access .prepost .PreAuthorize ;
4243import org .springframework .web .bind .annotation .*;
4344
4445import java .util .HashMap ;
@@ -63,11 +64,11 @@ public class WFSHarvesterApi {
6364 produces = MediaType .APPLICATION_JSON_VALUE ,
6465 method = RequestMethod .PUT )
6566 @ ResponseStatus (value = HttpStatus .OK )
67+ @ PreAuthorize ("hasAuthority('Editor')" )
6668 @ ResponseBody
6769 public JSONObject indexWfs (
6870 @ RequestBody WFSHarvesterParameter config ) throws Exception {
6971
70- // TODO: Check user is authenticated ?
7172 JSONObject result = new JSONObject ();
7273 result .put ("success" , true );
7374 result .put ("indexedFeatures" ,
@@ -85,6 +86,7 @@ public JSONObject indexWfs(
8586 produces = MediaType .ALL_VALUE ,
8687 method = RequestMethod .DELETE )
8788 @ ResponseStatus (value = HttpStatus .OK )
89+ @ PreAuthorize ("hasAuthority('Editor')" )
8890 @ ResponseBody
8991 public JSONObject deleteWfs (
9092 @ RequestParam
@@ -95,12 +97,9 @@ public JSONObject deleteWfs(
9597 EsWFSFeatureIndexer indexer = ApplicationContextHolder .get ().getBean (EsWFSFeatureIndexer .class );
9698 indexer .deleteFeatures (serviceUrl , typeName , client );
9799
98- // TODO: Check user is authenticated ?
99100 JSONObject result = new JSONObject ();
100101 result .put ("success" , true );
101- // result.put("indexedFeatures",
102- // sendMessage(config));
103-
102+
104103 return result ;
105104 }
106105
0 commit comments