PB-2696: Publish UserRole and release new version - #88
Closed
eirinikouvara wants to merge 4 commits into
Closed
Conversation
Contributor
Author
|
Closing as this will be moved to dev-types instead. |
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.
Adds a
UserRoleenum to define user roles for access control within the uncertainty engine types.Changes
user_role.py: defines UserRole(str, Enum) with two roles:test_user_role.pytests covering:Notes
UserRole inherits from both str and Enum, meaning members can be used directly as strings (e.g. in JSON serialisation and string comparisons) without needing to access .value (similar pattern to token.py).
Why include the UserRole in the types library?
The UserRole enum lives in the shared types package so both the accounts service and the public core API import one canonical definition: adding or renaming a role is a single source edit, with no risk of the two services drifting out of sync over duplicated copies. (Note: only the inert role identifiers are shared this way — the role→permission mapping stays private to the accounts service.)