From e055847f74de505c266be91cfafcc9dff4031fde Mon Sep 17 00:00:00 2001 From: Craig Perkins Date: Mon, 23 Dec 2024 16:21:35 -0500 Subject: [PATCH] Rename to isSharedWithCurrentUser Signed-off-by: Craig Perkins --- .../opensearch/security/spi/DefaultResourceSharingService.java | 2 +- .../org/opensearch/security/spi/ResourceSharingService.java | 2 +- .../spi/actions/resource/get/GetResourceTransportAction.java | 2 +- .../spi/actions/resource/list/ListResourceTransportAction.java | 2 +- .../security/resource/SecurityResourceSharingService.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spi/src/main/java/org/opensearch/security/spi/DefaultResourceSharingService.java b/spi/src/main/java/org/opensearch/security/spi/DefaultResourceSharingService.java index ef40b0ae56..82cd32c4a5 100644 --- a/spi/src/main/java/org/opensearch/security/spi/DefaultResourceSharingService.java +++ b/spi/src/main/java/org/opensearch/security/spi/DefaultResourceSharingService.java @@ -5,7 +5,7 @@ public class DefaultResourceSharingService implements ResourceSharingService { @Override - public void hasResourceBeenSharedWith(String resourceId, ActionListener resourceSharingListener) { + public void isSharedWithCurrentUser(String resourceId, ActionListener resourceSharingListener) { resourceSharingListener.onResponse(Boolean.TRUE); } } diff --git a/spi/src/main/java/org/opensearch/security/spi/ResourceSharingService.java b/spi/src/main/java/org/opensearch/security/spi/ResourceSharingService.java index d2452a58bc..f60f2d1d01 100644 --- a/spi/src/main/java/org/opensearch/security/spi/ResourceSharingService.java +++ b/spi/src/main/java/org/opensearch/security/spi/ResourceSharingService.java @@ -3,5 +3,5 @@ import org.opensearch.core.action.ActionListener; public interface ResourceSharingService { - void hasResourceBeenSharedWith(String resourceId, ActionListener resourceSharingListener); + void isSharedWithCurrentUser(String resourceId, ActionListener resourceSharingListener); } diff --git a/spi/src/main/java/org/opensearch/security/spi/actions/resource/get/GetResourceTransportAction.java b/spi/src/main/java/org/opensearch/security/spi/actions/resource/get/GetResourceTransportAction.java index 2dc97f946a..8d93ed4c8b 100644 --- a/spi/src/main/java/org/opensearch/security/spi/actions/resource/get/GetResourceTransportAction.java +++ b/spi/src/main/java/org/opensearch/security/spi/actions/resource/get/GetResourceTransportAction.java @@ -111,7 +111,7 @@ public void onFailure(Exception e) { } }; - resourceSharingService.hasResourceBeenSharedWith(request.getResourceId(), shareListener); + resourceSharingService.isSharedWithCurrentUser(request.getResourceId(), shareListener); } catch (IOException e) { throw new OpenSearchException("Caught exception while loading resources: " + e.getMessage()); } diff --git a/spi/src/main/java/org/opensearch/security/spi/actions/resource/list/ListResourceTransportAction.java b/spi/src/main/java/org/opensearch/security/spi/actions/resource/list/ListResourceTransportAction.java index 77c4027d4a..d5639f62f3 100644 --- a/spi/src/main/java/org/opensearch/security/spi/actions/resource/list/ListResourceTransportAction.java +++ b/spi/src/main/java/org/opensearch/security/spi/actions/resource/list/ListResourceTransportAction.java @@ -123,7 +123,7 @@ public void onFailure(Exception e) { } }; - resourceSharingService.hasResourceBeenSharedWith(hit.getId(), shareListener); + resourceSharingService.isSharedWithCurrentUser(hit.getId(), shareListener); } catch (IOException e) { listResourceListener.onFailure( diff --git a/src/main/java/org/opensearch/security/resource/SecurityResourceSharingService.java b/src/main/java/org/opensearch/security/resource/SecurityResourceSharingService.java index 46b1ebc730..328fe711d4 100644 --- a/src/main/java/org/opensearch/security/resource/SecurityResourceSharingService.java +++ b/src/main/java/org/opensearch/security/resource/SecurityResourceSharingService.java @@ -81,7 +81,7 @@ private boolean hasPermissionsFor(User authenticatedUser, ResourceSharingEntry s } @Override - public void hasResourceBeenSharedWith(String resourceId, ActionListener resourceSharingListener) { + public void isSharedWithCurrentUser(String resourceId, ActionListener resourceSharingListener) { User authenticatedUser = (User) client.threadPool() .getThreadContext() .getPersistent(ConfigConstants.OPENDISTRO_SECURITY_AUTHENTICATED_USER);