Add permissions and claims fields to User model#172
Open
ztripez wants to merge 1 commit intomusic-assistant:mainfrom
Open
Add permissions and claims fields to User model#172ztripez wants to merge 1 commit intomusic-assistant:mainfrom
ztripez wants to merge 1 commit intomusic-assistant:mainfrom
Conversation
Support the claims-based permission system (server PR #2892). - permissions: list[str] — holds permission scope strings (e.g. 'library:read', 'players:control') set by the auth layer after JWT decode or role-based generation. - claims: dict[str, Any] — holds arbitrary JWT claims for future OIDC provider integration and provider-contributed custom claims. Both default to empty, so existing serialized User objects deserialize without issue.
marcelveldt
reviewed
Feb 27, 2026
Comment on lines
+42
to
+43
| permissions: list[str] = field(default_factory=list) | ||
| claims: dict[str, Any] = field(default_factory=dict) |
Member
There was a problem hiding this comment.
Would this be something you register per user or per role or even per token ?
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.
Summary
permissions: list[str]andclaims: dict[str, Any]fields to theUserdataclassFields
permissions— holds permission scope strings (e.g.library:read,players:control). Set by the server's auth layer after JWT decode or role-based generation. Replaces thegetattr(user, "_permissions")hack with a proper model attribute.claims— holds arbitrary JWT claims for future OIDC provider integration and provider-contributed custom claims (e.g.spotify:premium,tidal:subscription_tier).Backward Compatibility
Both fields use
field(default_factory=...)so they default to empty. Existing serializedUserobjects deserialize without issue — no breaking changes.