feat(python): expose Permissions and remaining user auth methods#3727
Open
ethanlin01x wants to merge 5 commits into
Open
feat(python): expose Permissions and remaining user auth methods#3727ethanlin01x wants to merge 5 commits into
ethanlin01x wants to merge 5 commits into
Conversation
ethanlin01x
force-pushed
the
feat/python-permissions
branch
2 times, most recently
from
July 21, 2026 16:05
63a8908 to
84a9f3b
Compare
Mirror the Rust Permissions, GlobalPermissions, StreamPermissions, and TopicPermissions types as PyO3 classes so user permissions can be built and inspected from Python. Stream and topic dict keys are typed u32 to match the wire format, so out-of-range IDs fail at construction instead of being silently truncated. The client methods that consume these classes follow in the next commits.
create_user hardcoded None for permissions, so every user came out unprivileged and UserInfoDetails gave no way to inspect grants. Wire the Permissions argument through create_user and add the permissions getter so grants round-trip through get_user. The credential helpers shared by the user tests move to tests/utils.py for the new enforcement tests.
Permissions set at creation were frozen: there was no way to grant, replace, or revoke them afterwards. update_permissions is a full replacement and None clears the permissions entirely, matching the Rust client semantics.
Password rotation required deleting and recreating the user, losing its id and permissions. change_password verifies the current password server-side, and a user can rotate its own credentials without any admin permission.
Sessions could only be abandoned by dropping the connection, leaving the server-side session authenticated until the socket closed. logout_user ends the session explicitly; a later login_user on the same client starts a fresh one.
ethanlin01x
force-pushed
the
feat/python-permissions
branch
from
July 21, 2026 16:11
84a9f3b to
22bc32c
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3727 +/- ##
============================================
+ Coverage 74.34% 74.38% +0.03%
Complexity 950 950
============================================
Files 1303 1304 +1
Lines 148712 148951 +239
Branches 124225 124225
============================================
+ Hits 110562 110793 +231
- Misses 34673 34681 +8
Partials 3477 3477
🚀 New features to boost your workflow:
|
ethanlin01x
marked this pull request as ready for review
July 21, 2026 16:23
Contributor
Author
|
/ready |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR address?
Closes #3726
Rationale
The Python SDK could create users but not grant them access to anything:
create_userhardcodedNonefor permissions, andupdate_permissions,change_password, and logout_user` were unexposed.What changed?
Before, the Python SDK could create users but not grant them access to anything:
create_userhardcodedNonefor permissions, andupdate_permissions,change_password, andlogout_userwere unexposed.Now the Rust
Permissionshierarchy is mirrored as PyO3 classes,create_usertakes an optionalpermissionsargument,UserInfoDetailsexposes apermissionsgetter, and the three missing methods complete theUserClientsurface, with the underlying Rust client handling the wire encoding.Local Execution
AI Usage
Claude was used to help generate and review this PR and all the changes are checked by the human.