Skip to content

Commit 0edea9e

Browse files
committed
Consider '_' when naming perms
1 parent f9ce8d1 commit 0edea9e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

reflectioning/src/main/java/io/tinyauth/elasticsearch/reflection/App.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ private static String getPermissionForAction(Class<? extends Action> actionType)
6868

6969
return Stream.of(permissionName.split(":"))
7070
.flatMap(part -> Stream.of(part.split("/")))
71+
.flatMap(part -> Stream.of(part.split("_")))
7172
.map(part -> part.substring(0, 1).toUpperCase() + part.substring(1).toLowerCase())
7273
.collect(Collectors.joining());
7374
}

src/main/java/io/tinyauth/elasticsearch/ActionIndicesAdaptor.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ public ActionIndicesAdaptor(String partition, String service, String region) {
182182
this.region = region;
183183

184184
this.methods = new HashMap<>();
185+
185186
/* ClusterAllocationExplainRequest */
186187
this.methods.put(ClusterAllocationExplainRequest.class, (permissions, request) -> {
187188
ClusterAllocationExplainRequest req = (ClusterAllocationExplainRequest)request;
@@ -204,7 +205,7 @@ public ActionIndicesAdaptor(String partition, String service, String region) {
204205
/* NodesHotThreadsRequest */
205206
this.methods.put(NodesHotThreadsRequest.class, (permissions, request) -> {
206207
NodesHotThreadsRequest req = (NodesHotThreadsRequest)request;
207-
Set<String> permission = permissions.get("ClusterMonitorNodesHot_threads");
208+
Set<String> permission = permissions.get("ClusterMonitorNodesHotThreads");
208209
/* WARNING: No particular resource types were identified */
209210
permission.add(formatArn());
210211

@@ -323,7 +324,7 @@ public ActionIndicesAdaptor(String partition, String service, String region) {
323324
/* ClusterSearchShardsRequest */
324325
this.methods.put(ClusterSearchShardsRequest.class, (permissions, request) -> {
325326
ClusterSearchShardsRequest req = (ClusterSearchShardsRequest)request;
326-
Set<String> permission = permissions.get("IndicesAdminShardsSearch_shards");
327+
Set<String> permission = permissions.get("IndicesAdminShardsSearchShards");
327328
/* this index related request has an indices() method */
328329
Stream.of(req.indices()).map(idx -> formatArn("index", idx)).forEach(permission::add);
329330

@@ -536,7 +537,7 @@ public ActionIndicesAdaptor(String partition, String service, String region) {
536537
/* SyncedFlushRequest */
537538
this.methods.put(SyncedFlushRequest.class, (permissions, request) -> {
538539
SyncedFlushRequest req = (SyncedFlushRequest)request;
539-
Set<String> permission = permissions.get("IndicesAdminSynced_flush");
540+
Set<String> permission = permissions.get("IndicesAdminSyncedFlush");
540541
/* this index related request has an indices() method */
541542
Stream.of(req.indices()).map(idx -> formatArn("index", idx)).forEach(permission::add);
542543

@@ -653,7 +654,7 @@ public ActionIndicesAdaptor(String partition, String service, String region) {
653654
/* IndicesShardStoresRequest */
654655
this.methods.put(IndicesShardStoresRequest.class, (permissions, request) -> {
655656
IndicesShardStoresRequest req = (IndicesShardStoresRequest)request;
656-
Set<String> permission = permissions.get("IndicesMonitorShard_stores");
657+
Set<String> permission = permissions.get("IndicesMonitorShardStores");
657658
/* this index related request has an indices() method */
658659
Stream.of(req.indices()).map(idx -> formatArn("index", idx)).forEach(permission::add);
659660

@@ -775,7 +776,7 @@ public ActionIndicesAdaptor(String partition, String service, String region) {
775776
/* FieldCapabilitiesRequest */
776777
this.methods.put(FieldCapabilitiesRequest.class, (permissions, request) -> {
777778
FieldCapabilitiesRequest req = (FieldCapabilitiesRequest)request;
778-
Set<String> permission = permissions.get("IndicesDataReadField_caps");
779+
Set<String> permission = permissions.get("IndicesDataReadFieldCaps");
779780
/* this index related request has an indices() method */
780781
Stream.of(req.indices()).map(idx -> formatArn("index", idx)).forEach(permission::add);
781782

@@ -784,7 +785,7 @@ public ActionIndicesAdaptor(String partition, String service, String region) {
784785
/* FieldStatsRequest */
785786
this.methods.put(FieldStatsRequest.class, (permissions, request) -> {
786787
FieldStatsRequest req = (FieldStatsRequest)request;
787-
Set<String> permission = permissions.get("IndicesDataReadField_stats");
788+
Set<String> permission = permissions.get("IndicesDataReadFieldStats");
788789
/* this index related request has an indices() method */
789790
Stream.of(req.indices()).map(idx -> formatArn("index", idx)).forEach(permission::add);
790791

0 commit comments

Comments
 (0)