-
Notifications
You must be signed in to change notification settings - Fork 337
[Resource Sharing] Adds a Share API to fetch and update sharing information #5459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This PR has changes from #5408 and hence that PR must be reviewed prior to reviewing this one. |
e7109db to
bc20bf0
Compare
71dcb2c to
96b94da
Compare
52cdbc8 to
45221d0
Compare
43a37ea to
23e706a
Compare
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
23e706a to
4b0fb80
Compare
d672123 to
4b0fb80
Compare
src/main/java/org/opensearch/security/resources/ResourceSharingIndexHandler.java
Outdated
Show resolved
Hide resolved
…est object parser Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
… of add or revoke in patch object Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
This API will mostly be called by dashboards and REST clients. We have thus far used notion of resource-index everywhere. I'm not too opinionated on resource-index but I think it makes more sense as it strictly ties with the index where the resource is stored. |
…d corrections Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
spi/src/test/java/org/opensearch/security/spi/resources/ShareWithTests.java
Show resolved
Hide resolved
src/main/java/org/opensearch/security/resources/api/share/ShareRequest.java
Outdated
Show resolved
Hide resolved
sample-resource-plugin/src/integrationTest/java/org/opensearch/sample/resource/TestUtils.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
08c74d9 to
42b8e87
Compare
|
|
||
| // Apply patch and update the document | ||
| sharingInfoListener.whenComplete(resourceSharing -> { | ||
| ShareWith updatedShareWith = resourceSharing.getShareWith(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we always have this return empty if not present and move null handling to within add() and revoke().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could also avoid re-assigning this variable and have the updates occur in-place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be fine here. No point in creating and returning empty object if not shareWith exists.
src/main/java/org/opensearch/security/resources/api/share/ShareRequest.java
Outdated
Show resolved
Hide resolved
…equest Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Description
Adds a new
/shareAPI to support sharing of resources by dashboard component. It supports three methods:/_plugins/_security/api/resource/share- requires two query params?resource_id=<id>&resource_type=<name>to be present./_plugins/_security/api/resource/share{ "resource_id": "%s", "resource_type": "%s", "share_with": { "%s" : { "users": ["%s"] } } }/_plugins/_security/api/resource/share{ "resource_id": "%s", "resource_type": "%s", "add": { %s }, "revoke": { %s } }addblock contains information of entities and levels at which to sharerevokeblock contains information of entities and levels at which to revokeThe structure for PUT and PATCH request content' sharing block must look like:
{ "READ_ONLY": { "users": ["user1", "user2"], "roles": ["viewer_role"], "backend_roles": ["data_analyst"] }, "READ_WRITE": { "users": ["admin_user"], "roles": ["editor_role"], "backend_roles": ["content_manager"] } }Issues Resolved
TBD
Do these changes introduce new permission(s) to be displayed in the static dropdown on the front-end? If so, please open a draft PR in the security dashboards plugin and link the draft PR here
TBD
Testing
Integration testing
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.