Skip to content

Commit

Permalink
Modifies some method names and comments
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Sep 10, 2024
1 parent 8b8fffd commit 7e7cd0a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import org.opensearch.accesscontrol.resources.EntityType;
import org.opensearch.accesscontrol.resources.ResourceSharing;
import org.opensearch.accesscontrol.resources.ShareWith;

import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -55,11 +56,11 @@ public boolean hasPermission(String resourceId, String systemIndexName) {
/**
* @param resourceId if of the resource to be updated
* @param systemIndexName index where this resource is defined
* @param revokeAccess a map that contains entries of entities with whom this resource should be shared with
* @param shareWith a map that contains entries of entities with whom this resource should be shared with
* @return null since security plugin is disabled in the cluster
*/
@Override
public ResourceSharing shareWith(String resourceId, String systemIndexName, Map<EntityType, List<String>> revokeAccess) {
public ResourceSharing shareWith(String resourceId, String systemIndexName, ShareWith shareWith) {
return null;
}

Expand All @@ -85,11 +86,10 @@ public boolean deleteResourceSharingRecord(String resourceId, String systemIndex
}

/**
* @param entity whose resource sharing entries are to be deleted
* @return false since security plugin is disabled
*/
@Override
public boolean deleteAllResourceSharingRecordsFor(String entity) {
public boolean deleteAllResourceSharingRecordsForCurrentUser() {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import org.opensearch.accesscontrol.resources.EntityType;
import org.opensearch.accesscontrol.resources.ResourceSharing;
import org.opensearch.accesscontrol.resources.ShareWith;

import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -50,12 +51,13 @@ public interface ResourceAccessControlPlugin {

/**
* Adds an entity to the share-with. Resource needs to be in restricted mode.
* @param resourceId if of the resource to be updated
* Creates a resource sharing record if one doesn't exist.
* @param resourceId id of the resource to be updated
* @param systemIndexName index where this resource is defined
* @param entities a map that contains entries of entities with whom the resource should be shared with
* @param shareWith an object that contains entries of entities with whom the resource should be shared with
* @return updated resource sharing record
*/
ResourceSharing shareWith(String resourceId, String systemIndexName, Map<EntityType, List<String>> entities);
ResourceSharing shareWith(String resourceId, String systemIndexName, ShareWith shareWith);

/**
* Revokes given permission to a resource
Expand All @@ -76,11 +78,11 @@ public interface ResourceAccessControlPlugin {
boolean deleteResourceSharingRecord(String resourceId, String systemIndexName);

/**
* Deletes all entries from .resource_sharing index where requested entity is the creator of the resource
* @param entity whose resource sharing records are to be deleted
* TODO check if this method is needed
* Deletes all entries from .resource_sharing index where current user is the creator of the resource
* @return true if resource record was deleted, false otherwise
*/
boolean deleteAllResourceSharingRecordsFor(String entity);
boolean deleteAllResourceSharingRecordsForCurrentUser();

// TODO: Check whether methods for bulk updates are required
}

0 comments on commit 7e7cd0a

Please sign in to comment.