diff --git a/duniter4j-es-assembly/src/main/assembly/config/elasticsearch.yml b/duniter4j-es-assembly/src/main/assembly/config/elasticsearch.yml index 743b8bcb533c22e1f61815e675ef5400435adb12..31be3af2b8b1b7210eabbfeda9f008eee2a50d77 100644 --- a/duniter4j-es-assembly/src/main/assembly/config/elasticsearch.yml +++ b/duniter4j-es-assembly/src/main/assembly/config/elasticsearch.yml @@ -151,7 +151,7 @@ duniter.security.enable: true # Should synchronize data using P2P # duniter.data.sync.enable: true -duniter.data.sync.host: data.duniter.fr +duniter.data.sync.host: data.gtest.duniter.fr duniter.data.sync.port: 80 # ---------------------------------- Duniter4j SMTP server ------------------------- diff --git a/duniter4j-es-assembly/src/test/es-home/config/elasticsearch.yml b/duniter4j-es-assembly/src/test/es-home/config/elasticsearch.yml index 3b4f087ed970a2e36c1888d2b5f341e95ffd9e1b..850b5dddb0a164bb697a700edbb41496b86b8448 100644 --- a/duniter4j-es-assembly/src/test/es-home/config/elasticsearch.yml +++ b/duniter4j-es-assembly/src/test/es-home/config/elasticsearch.yml @@ -127,7 +127,7 @@ duniter.blockchain.sync.enable: true # Duniter node to synchronize # -duniter.host: gtest.duniter.fr +duniter.host: gtest.duniter.org duniter.port: 10900 # diff --git a/duniter4j-es-core/src/main/java/org/duniter/elasticsearch/PluginInit.java b/duniter4j-es-core/src/main/java/org/duniter/elasticsearch/PluginInit.java index a35f55c7072d06f3ba4a8f1309980a61d27cafb6..b8d4bde5a57834e778f2ddb9caa12c1148c4a26f 100644 --- a/duniter4j-es-core/src/main/java/org/duniter/elasticsearch/PluginInit.java +++ b/duniter4j-es-core/src/main/java/org/duniter/elasticsearch/PluginInit.java @@ -116,13 +116,20 @@ public class PluginInit extends AbstractLifecycleComponent<PluginInit> { // Index (or refresh) node's currency Currency currency = injector.getInstance(CurrencyService.class).indexCurrencyFromPeer(peer, true); - // Add access to currency index + // Add access to currency/block index injector.getInstance(RestSecurityController.class).allowIndexType(RestRequest.Method.GET, currency.getCurrency(), BlockchainService.BLOCK_TYPE); + injector.getInstance(RestSecurityController.class).allowPostSearchIndexType( + currency.getCurrency(), + BlockchainService.BLOCK_TYPE); + // Add access to currency/peer index injector.getInstance(RestSecurityController.class).allowIndexType(RestRequest.Method.GET, currency.getCurrency(), BlockchainService.PEER_TYPE); + injector.getInstance(RestSecurityController.class).allowPostSearchIndexType( + currency.getCurrency(), + BlockchainService.PEER_TYPE); // Index blocks (and listen if new block appear) injector.getInstance(BlockchainService.class) diff --git a/duniter4j-es-core/src/main/java/org/duniter/elasticsearch/rest/security/RestSecurityController.java b/duniter4j-es-core/src/main/java/org/duniter/elasticsearch/rest/security/RestSecurityController.java index 1960041034987b0ed5c5c369b083442c2399f7f5..6da9bb84f7e1c5865047b168fba92cb0033ad9e0 100644 --- a/duniter4j-es-core/src/main/java/org/duniter/elasticsearch/rest/security/RestSecurityController.java +++ b/duniter4j-es-core/src/main/java/org/duniter/elasticsearch/rest/security/RestSecurityController.java @@ -57,6 +57,10 @@ public class RestSecurityController extends AbstractLifecycleComponent<RestSecur return allow(method, String.format("/%s/%s(/.*)?", index, type)); } + public RestSecurityController allowPostSearchIndexType(String index, String type) { + return allow(RestRequest.Method.POST, String.format("/%s/%s/_search", index, type)); + } + public RestSecurityController allowImageAttachment(String index, String type, String field) { return allow(RestRequest.Method.GET, String.format("/%s/%s/[^/]+/_image/%s.*", index, type, field)); }