Skip to content

Commit

Permalink
Updates method references to conform to core
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Oct 4, 2024
1 parent 8151697 commit 117671c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.opensearch.action.support.HandledTransportAction;
import org.opensearch.action.support.WriteRequest;
import org.opensearch.client.Client;
import org.opensearch.common.inject.Inject;
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.core.action.ActionListener;
import org.opensearch.core.xcontent.ToXContent;
Expand All @@ -45,6 +46,7 @@ public class CreateResourceTransportAction extends HandledTransportAction<Create
private final Client nodeClient;
private final String resourceIndex;

@Inject
public CreateResourceTransportAction(
TransportService transportService,
ActionFilters actionFilters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public ListAccessibleResourcesTransportAction(TransportService transportService,
protected void doExecute(Task task, ListAccessibleResourcesRequest request, ActionListener<ListAccessibleResourcesResponse> listener) {
try {
ResourceService rs = SampleResourcePlugin.GuiceHolder.getResourceService();
List<String> resourceIds = rs.getResourceAccessControlPlugin().listAccessibleResourcesForPlugin(RESOURCE_INDEX_NAME);
List<String> resourceIds = rs.getResourceAccessControlPlugin().listAccessibleResourcesInPlugin(RESOURCE_INDEX_NAME);
log.info("Successfully fetched accessible resources for current user");
listener.onResponse(new ListAccessibleResourcesResponse(resourceIds));
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.HandledTransportAction;
import org.opensearch.client.Client;
import org.opensearch.common.inject.Inject;
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.core.action.ActionListener;
import org.opensearch.sample.SampleResourcePlugin;
Expand All @@ -39,6 +40,7 @@ public class ShareResourceTransportAction extends HandledTransportAction<ShareRe
private final Client nodeClient;
private final String resourceIndex;

@Inject
public ShareResourceTransportAction(
TransportService transportService,
ActionFilters actionFilters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2217,13 +2217,8 @@ private void tryAddSecurityProvider() {
}

@Override
public Map<String, List<String>> listAccessibleResources() {
return this.resourceAccessHandler.listAccessibleResources();
}

@Override
public List<String> listAccessibleResourcesForPlugin(String systemIndexName) {
return this.resourceAccessHandler.listAccessibleResourcesForPlugin(systemIndexName);
public List<String> listAccessibleResourcesInPlugin(String systemIndexName) {
return this.resourceAccessHandler.listAccessibleResourcesInPlugin(systemIndexName);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public Map<String, List<String>> listAccessibleResources() {
return Map.of();
}

public List<String> listAccessibleResourcesForPlugin(String systemIndex) {
public List<String> listAccessibleResourcesInPlugin(String systemIndex) {
final User user = threadContext.getTransient(ConfigConstants.OPENDISTRO_SECURITY_USER);
LOGGER.info("Listing accessible resource within a system index {} for : {}", systemIndex, user.getName());

Expand Down

0 comments on commit 117671c

Please sign in to comment.