Repository navigation
docs: ADR - API Contract for Custom Roles - #607
Conversation
|
Thanks for the pull request, @rodmgwgu! 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. |
| sorts them in Python, and then paginates. The list is bounded by the schema roles plus the custom | ||
| roles of the instance. User counts are computed with one grouped query, not one query per role. | ||
|
|
||
| 5. Validation |
There was a problem hiding this comment.
I think for security reasons none of these fields should be editable, not even the permissions, except maybe the description. Editing a role's permissions changes the access of every user who holds it right away, and nothing records who made the change or why. I explained this in more detail in ADR 0035. If roles stay immutable, PATCH would only accept description, and changing permissions would mean creating a new role.
BryanttV
left a comment
There was a problem hiding this comment.
LGTM! Thanks for this! Just one comment.
| ============ | ||
|
|
||
| Removing a role that has assignments must be confirmed explicitly. The request confirms it with the | ||
| ``assignments=revoke`` query parameter, which deletes the assignments together with the role. |
There was a problem hiding this comment.
What other values would assignments accept here? The parameter made sense when it chose between revoke and reassign, but if revoke is the only value left, why don't we use something like revoke=true?
There was a problem hiding this comment.
I kept it this way in case we implement the reassign feature in the future, so we don't have to do a breaking change here.
| team. Letting them do so later requires a decision on privilege escalation. | ||
| * Two roles cannot share a display name, so the assignment wizard and the Team Members view never | ||
| show two roles with the same name. | ||
| * Clients must compute dependencies before saving. A client that does not gets a 400 that names the |
There was a problem hiding this comment.
Why is this the client's responsibility and not something the framework does explicitly? I see the server already rejects incomplete sets, and the rejected alternative explains why it doesn't add dependencies silently. But the catalog only returns direct depends_on lists (ADR 0034), so every client has to compute the indirect ones on its own. Could the framework provide that instead?
There was a problem hiding this comment.
My original reasoning on ADR 0034 was that the UI would need to do the logic anyway because it needs to automatically select dependencies when a permission is checked, and to warn the user when disabling a permission that another one depends on.
However now that you mention it I think adding the full set of dependencies to the endpoint response is a good idea. I'll add that, thanks!
There was a problem hiding this comment.
Done, added an all_depends_on property which lists all dependencies including indirect ones.
536bfc8 to
57a98f6
Compare
mariajgrimaldi
left a comment
There was a problem hiding this comment.
LGTM! Thanks so much for addressing my comments :)
57a98f6 to
dc5b1d3
Compare
Closes #469
Problem
The Administrative Console needs to create, list, edit, copy, and remove custom roles, and to move a role's members to another role. ADR 0035 decides how custom roles are stored, but no ADR defines who can manage them or the REST API. The Roles and Permissions table also needs member counts, a last-updated date, search, and sorting, which the role catalog (ADR 0028) does not provide.
Approach
POST,GET,PATCH, andDELETEon/api/authz/v1/roles/<role>/, plusPOST /api/authz/v1/roles/<role>/reassign/.user_countandupdated_aton every role, andsearch,sort_by, andorderon the list. Search and sort run in Python so translated static role names match what the user sees.revokeorreassign, in one transaction.Manual testing instructions
Docs only. Both files pass
python -m docutils --halt=warning.Rollback plan
Revert this PR. Docs only. No code or migration.
Retro compatibility
No behavior change. This PR only records the decision. The implementation will follow in separate PRs.
AI Usage
Kiro assisted with research and ADR authoring, with human guidance on the decisions and validation against the existing ADRs.
Merge checklist: