Skip to content

Commit

Permalink
Remove allowed_actions from sharing endpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Dec 22, 2024
1 parent c00e1d0 commit 7c90e88
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ protected void doExecute(Task task, ShareWithRequest request, ActionListener<Sha
searchSourceBuilder.query(boolQuery);
searchRequest.source(searchSourceBuilder);

// Execute the search request
nodeClient.search(searchRequest, new ActionListener<SearchResponse>() {
nodeClient.search(searchRequest, new ActionListener<>() {
@Override
public void onResponse(SearchResponse searchResponse) {
if (Objects.requireNonNull(searchResponse.getHits().getTotalHits()).value == 1) {
// Record found, update it
SearchHit hit = searchResponse.getHits().getAt(0);
UpdateRequest updateRequest = new UpdateRequest(RESOURCE_SHARING_INDEX, hit.getId());
try {
Expand All @@ -78,14 +76,13 @@ public void onResponse(SearchResponse searchResponse) {
{
builder.field("users", request.getShareWith().getUsers());
builder.field("backend_roles", request.getShareWith().getBackendRoles());
builder.field("allowed_actions", request.getShareWith().getAllowedActions());
}
builder.endObject();
}
builder.endObject();
updateRequest.doc(builder);

nodeClient.update(updateRequest, new ActionListener<UpdateResponse>() {
nodeClient.update(updateRequest, new ActionListener<>() {
@Override
public void onResponse(UpdateResponse updateResponse) {
listener.onResponse(new ShareWithResponse("success"));
Expand All @@ -100,8 +97,6 @@ public void onFailure(Exception e) {
listener.onFailure(e);
}
} else {
// Record not found, create a new one
// createNewRecord(request, listener);
listener.onFailure(new IllegalStateException(".resource-sharing entry not found"));
}
}
Expand Down

0 comments on commit 7c90e88

Please sign in to comment.