diff --git a/docs/tutorial/IndexerService.md b/docs/tutorial/IndexerService.md index 5208cc9b30936fdc9c2ebc75fab57e2f47f9fb82..fe5efec94e251a1511532324a76a2022ffe8c652 100644 --- a/docs/tutorial/IndexerService.md +++ b/docs/tutorial/IndexerService.md @@ -27,7 +27,7 @@ parent, acl, namespace, type, version, legaltags, index to each record at the ti * Required roles - Indexer service requires that users (and service accounts) have dedicated roles in order to use it. Users must be a member of `users.datalake.viewers` or `users.datalake.editors` or `users.datalake.admins`, roles can be assigned using the [Entitlements Service](/solutions/osdu/tutorials/core-services/entitlementsservice). Please look at the API documentation for specific requirements. + Indexer service requires that users (and service accounts) have dedicated roles in order to use it. Users must be a member of `users.datalake.viewers` or `users.datalake.editors` or `users.datalake.admins`, `users.datalake.ops` roles can be assigned using the [Entitlements Service](/solutions/osdu/tutorials/core-services/entitlementsservice). Please look at the API documentation for specific requirements. In addition to service roles, users __must__ be a member of data groups to access the data. @@ -122,6 +122,23 @@ curl --request POST \ </details> [Back to table of contents](#TOC) +## Delete API <a name="delete"></a> +Delete api is used to delete an index for a specific kind. +Only users who belong to the Entitlement groups 'users.datalake.ops' can make calls to this API. + +``` +DELETE /api/indexer/v2/index?kind=opendes:welldb:wellbore:1.0.0 +``` + +<details><summary>**Curl**</summary> + +```bash +curl --request DELETE \ + --url '/api/indexer/v2/index?kind=opendes:welldb:wellbore:1.0.0' \ + --header 'authorization: Bearer <JWT>' \ + --header 'content-type: application/json' \ + --header 'data-partition-id: opendes' +``` ## Data Partition provision <a name="data-partition-provision"></a> diff --git a/indexer-core/src/main/java/org/opengroup/osdu/indexer/api/CleanupIndiciesApi.java b/indexer-core/src/main/java/org/opengroup/osdu/indexer/api/CleanupIndiciesApi.java index 9feff87940140c2f3f7688c0573f973c765842cb..6015414641fbf7a1cbc7f5b3be24af776715d196 100644 --- a/indexer-core/src/main/java/org/opengroup/osdu/indexer/api/CleanupIndiciesApi.java +++ b/indexer-core/src/main/java/org/opengroup/osdu/indexer/api/CleanupIndiciesApi.java @@ -68,6 +68,7 @@ public class CleanupIndiciesApi { private IndicesServiceImpl indicesService; + private static final String ENTITLEMENT_GROUP = "users.datalake.ops"; @ApiIgnore @PostMapping(path = "/index-cleanup", consumes = "application/json") @@ -108,7 +109,7 @@ public class CleanupIndiciesApi { } @DeleteMapping(value = "/index", produces = MediaType.APPLICATION_JSON_VALUE) - @PreAuthorize("@authorizationFilter.hasPermission('" + SearchServiceRole.ADMIN + "')") + @PreAuthorize("@authorizationFilter.hasPermission('" + ENTITLEMENT_GROUP + "')") public ResponseEntity deleteIndex(@RequestParam("kind") @NotBlank @ValidKind String kind) { String index = elasticIndexNameResolver.getIndexNameFromKind(kind); try {