Skip to content
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

feat: RBAC support (Sync/Async) #349

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open

feat: RBAC support (Sync/Async) #349

wants to merge 24 commits into from

Conversation

bevzzz
Copy link
Collaborator

@bevzzz bevzzz commented Jan 24, 2025

Related to #343.

This PR is the first iteration of that story, adding RBAC support to the sync client.
Initially it drew a lot on the Python's client, but I ended up re-organizing things to be consistent with the current client.

  • Adds support for RBAC endpoints via client.async().roles()
  • Unified integration test suite for sync and async clients -- would love to hear your opinion on that.

Files to pay attention to (have denser logic):

Permission.java
WeaviatePermission.java
Role.java
WeaviateRole.java
ClientRbacTestSuite.java

Copy link

@orca-security-eu orca-security-eu bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@bevzzz bevzzz linked an issue Jan 24, 2025 that may be closed by this pull request
@bevzzz bevzzz changed the title Feature/rbac async RBAC for AsyncClient Jan 24, 2025
Makes creating several permissions for the same resource easier.
For example, instead of 'Permission.data('Pizza', CREATE), Permission.data('Pizza', DELETE)'
users can write 'Permission.data('Pizza', CREATE, DELETE)'.

To avoid having ~4 different withPermission() builder methods in the client classes
all factory methods on Permission class will return Permission[] (even if known to be length 1).
Moved to a separate file and documented.
@bevzzz bevzzz changed the title RBAC for AsyncClient RBAC Support (Sync/Async) Jan 30, 2025
@bevzzz bevzzz changed the title RBAC Support (Sync/Async) RBAC support Jan 30, 2025
@bevzzz bevzzz changed the title RBAC support feat: RBAC support (Sync/Async) Jan 30, 2025
* Then {@code MyAction.FOO} can be retrieved from "do_foo" using
* {@link #fromString}.
*/
interface RbacAction {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't RbacAction interface be public?

Copy link
Collaborator Author

@bevzzz bevzzz Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't need to, because we only ever use it internally for deserializing responses from the server.
What the user passes/receives is one of the "concrete" public enums that implement RbacAction.

Ideally, we want to shield the user from the methods of this interface, because passing an invalid string might throw an IllegalArgumentException.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for RBAC
2 participants