Repository navigation
docs: add ADR 0028 API contract for the role and permission catalog - #508
Conversation
|
Thanks for the pull request, @BryanttV! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
rodmgwgu
left a comment
There was a problem hiding this comment.
Overall looking good, Added some comments for consideration. Thanks!
dcoa
left a comment
There was a problem hiding this comment.
it looks good so far, just 1 change and some questions.
Define the response of GET /api/authz/v1/roles/ queried by scope_type, returning paginated roles with the categories and permissions catalogs needed by the Admin Console roles and permissions matrix. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Record that scope types could later be resolved from scope_registry so plugins can contribute new ones, while course and library stay explicit for now. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Replace scope_type with a comma-separated scope_types parameter so the catalog can later serve roles with multiple scope types. A role is returned if it has grants in any requested type, and the user needs the view-team permission of each one. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Roles that exist only in the Casbin policy are no longer listed, so the catalog reads only from the database and filtering and pagination stay in a single query. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Frame the API as the source of truth for the descriptive information of the authz model instead of around the current matrix UI. The same data also feeds the permissions sub-table and the wizard role list, so generalize the remaining matrix-specific wording. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Rename the response scope_types to scopes using backend namespaces (course-v1, lib) and add scopes to each permission. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
bd25133 to
45b3db7
Compare
Match the field name used by the authz schema. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Describe extracting the logic shared with AnyScopePermission instead of duplicating it in the permission of the role catalog endpoint. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
mariajgrimaldi
left a comment
There was a problem hiding this comment.
LGTM! Thanks so much for addressing my comments :)
Description
Adds ADR 0028, which defines the response contract of
GET /api/authz/v1/roles/when queried byscope_types. ADR 0021 decided that this endpoint returns the definitions stored in the authz model, but left the exact response shape open. This ADR defines it.The Roles and Permissions tab of the Admin Console renders a matrix (roles × permissions grouped by category) for one or more scope types at a time. Today the frontend hardcodes all of this (
course/constants.ts,library/constants.ts). The matrix needs every permission of the requested scope types, including the ones a role does not grant, so a list of roles that only carries the permissions each one grants is not enough.Key decisions
scope_types(required): a comma-separated list ofcourseand/orlibrary, with at least one value. Duplicates are collapsed. An empty item or an unsupported value returns a 400. Thescopeparameter is removed.courses.view_course_teamforcourseandcontent_libraries.view_library_teamforlibrary, in any scope. When several scope types are requested, the user must hold the permission for each one. This needs a new permission class, sinceDynamicScopePermissionandAnyScopePermissioncannot express it.permissionscontains the permissions supported by any requested scope type. A role is listed if it has grants in any of them, and itspermissionsare the ones it grants across them.categoriesandpermissionscatalogs are sent once, and each role references permissions by ID. The response returns the requestedscopes. The client can build each matrix cell directly.user_countis calculated across the requested scope types and counts distinct users, not a single scope.hiddenroles (ADR 0023) are excluded, and roles without a stored definition are not listed.Manual testing
Documentation only. To review, read
docs/decisions/0028-api-contract-for-role-catalog.rstor check the docs.Implementation PR
Merge checklist