Repository navigation
feat(access): roles with permissions and custom roles per namespace - #373
Merged
Merged
Conversation
Viewer, editor and owner become sets of permissions (read, edit, import, process, curate, share, publish, remove, members, manage). Admins make custom roles from them (Admin > Roles, /api/v1/roles) and give them per namespace like the built-in ones; routes for importing, processing, curating, sharing, publishing, removing, people and namespace settings check the permission. Existing access is unchanged. Non-admin members managers give only roles they hold all of. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013CspHV36KRyiRJ9LsFqK53
Merged
16 of 22 tasks
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.
Requested by Adeel · project thread
Description
Part 2 of the user manager and RBAC work (part 1 was #286).
Before: a namespace role was one of viewer, editor or owner, and every check compared ranks.
After: a role is a set of permissions (read, edit, import, process, curate, share, publish, remove, members, manage). Viewer, editor and owner are built in and unchanged. Admins make custom roles in Admin › Roles (a permission matrix) or through
GET/POST/PATCH/DELETE /api/v1/roles, and give them per namespace like the built-in ones. Changing a role applies at once to everyone holding it, and a role somebody holds can't be deleted.How:
domain/roles.pyholds the permission table and the newroletable.Principal.permsis resolved next to the ranks, andAccess.need/need_inaccept a permission name. Routes for import, process, curate, share, publish, remove, members and manage now ask for that permission. Other checks stay rank-based, and a custom role counts as the largest built-in role it fully covers, so it never gets more than its permissions. Someone with the members permission can give only roles whose permissions are within their own, so they can't promote themselves or remove an owner./auth/mereturnspermissionsper namespace, and the assistant'schange_personaccepts custom roles.Motivation and Context
Adeel asked for a user manager and RBAC.
Types of changes
Checklist:
tests/api/test_roles.py;test_users.pynow expects 400 for an unknown role).docs/(access.md "Roles and permissions", api.md, authentication.md).## Unreleased.Done questions
/rolesAPI,/auth/mepermissions, and the assistant'schange_personwith any role.roletable is defined at startup.make openapi.Refine later:
🤖 Generated with Claude Code
https://claude.ai/code/session_013CspHV36KRyiRJ9LsFqK53
Generated by Claude Code