Repository navigation
Permissions tab - #305
Permissions tab#305diana-villalvazo-wgu wants to merge 11 commits into
Conversation
|
Thanks for the pull request, @diana-villalvazo-wgu! 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. 🔘 Update the status of your PRYour PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate. Where 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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## jacobo/create-role-wizard-3 #305 +/- ##
===============================================================
+ Coverage 99.29% 99.31% +0.02%
===============================================================
Files 110 110
Lines 2125 2197 +72
Branches 629 705 +76
===============================================================
+ Hits 2110 2182 +72
Misses 15 15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
02da7b4 to
19737ae
Compare
5a116f4 to
969d1ef
Compare
…dling loading, error and success states
969d1ef to
ef8f238
Compare
rodmgwgu
left a comment
There was a problem hiding this comment.
openedx/openedx-authz#577 asks for a confirm when navigating away with unsaved changes. I don't see that here, so leaving the page drops the edits without warning. Can we add it?
Also, can you update the PR description to reflect latest changes please?
Thanks!
| }, | ||
| 'authz.custom.role.changes.description': { | ||
| id: 'authz.custom.role.changes.description', | ||
| defaultMessage: 'Your changes will not take effect until you save your progress. Take care with key and value formatting, as validation is not implemented.', |
There was a problem hiding this comment.
I think we should remove the part that says "Take care with key and value formatting, as validation is not implemented", seems this was a leftover from an early prototype that got to the design
| categories={scopeCatalog.categories} | ||
| permissions={permissions} | ||
| selection={selection} | ||
| isReadOnly={!isCustomRole(role)} |
There was a problem hiding this comment.
This only checks that the role is custom, so a user who can view the role but isn't staff or superuser gets the switches and Save changes, and only finds out with a 403 on save. Can we also make it read-only when useCanManageRoles() is false, like the Duplicate and Delete actions on the page? A test for that case would be good too.
| [scopeType, initialPermissions], | ||
| ); | ||
| // The selection restarts from the seed whenever this id changes, so Cancel changes it. | ||
| const selection = usePermissionSelection(seed, `${role.role}#${resetCount}`, permissions); |
There was a problem hiding this comment.
nit: usePermissionSelection names and documents the first param (seed) as cloneSourceRole, but here it's a seed. Can we rename it to something like seedKey and update its JSDoc, so it reads right for both callers?
Description
The Permissions tab on the role detail page now shows the role's permissions. It uses the same matrix as the create custom role wizard: collapsible categories, search, expand/collapse all, and the PermissionsSummary beside them. The matrix is limited to the role's scope type and starts from the permissions the role grants.
Custom roles can be edited.
/api/authz/v1/roles/<role_id>/(openedx-authz ADR 0036). The request carries every permission now granted, chosen or required, in catalog order.Standard roles are read-only. The matrix lists only the permissions the role grants, with no switches and no Select all, and leaves out the categories where the role grants nothing. Search, expand/collapse all and the summary still work.
Errors are handled as in
CreateCustomRole:ERROR_TOAST_MAP, with a Retry that sends the same changes again.Changes
catalog:
RolePermissionsEditor.tsx:
isReadOnlytoPermissionsEditorfor standard roles.< EditRolePermissions role={role} />in the Permissions tab.Permissions matrix (roles-permissions/components)
PermissionsEditortakes an optionalisReadOnlyprop. It defaults to false, so the create custom role wizard works as before. When it's set, the matrix only lists the granted permissions and passesisReadOnlydown.PermissionCategorySectionhides Select all when read-only.PermissionRowhides the switch and the lock note when read-only.Renames
RolesPermissions→RoleComparison, the matrix shown in the Comparison tab. This keeps it from being confused withRolesPermissionsTableandEditRolePermissionsonce role-detail and roles-permissions are unified.Screenshots
View only for standard roles:

Edit mode for custom roles:

After a permissions change:

Support Info
Closes openedx/openedx-authz#577
LLM Usage
Built with assistance from Claude.