refactor: standardize the course & library roles-permissions data#170
refactor: standardize the course & library roles-permissions data#170dcoa wants to merge 2 commits into
Conversation
|
Thanks for the pull request, @dcoa! 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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #170 +/- ##
==========================================
+ Coverage 97.44% 97.45% +0.01%
==========================================
Files 66 66
Lines 1525 1533 +8
Branches 386 388 +2
==========================================
+ Hits 1486 1494 +8
Misses 39 39 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Brings the roles-permissions/course and roles-permissions/library constant files to a single, consistent shape, fixes several wrong library permission labels, and relocates the shared permission-matrix utilities out of library/. No user-facing behavior change beyond the corrected labels.
What & why
libraryPermissionsentries had labels/icons that didn't match their key or description (reminding from my previous refactor):DELETE_LIBRARYwas labeled "Publish" now "Delete".CREATE_LIBRARY_COLLECTIONshowed "View",EDITshowed "Publish",DELETEshowed "Edit", corrected toCreate / Edit / Deletewith matching icons.MANAGE_LIBRARY_TAGSlabeled as "Manage tag" to "Manage tags".course/constants.tspreviously hand-maintained a verboserolesObjectand a separatecourseRolesMetadata, duplicating each role's name/description and repeating the near-identical admin/staff permission arrays. It now mirrors library:courseRolesMetadatais the single metadata source,COURSE_ROLE_PERMISSIONSlookup map holds each role's permission keys,Role[]is derived viacourseRolesMetadata.map(...).rolesObject(courseRolesWithPermissions) androlesLibraryObject(libraryRolesWithPermissions): now a clear family with courseRolesMetadata / libraryRolesMetadata (metadata) vs *RolesWithPermissions (roles + permissions). Updated across the barrel, RolesPermissions, UserPermissions, and the test mocks/spies.Relocate the shared matrix utilities:
buildPermissionMatrixByResource/getPermissionMetadataare generic (used by both course and library), so they moved fromlibrary/utils.tstoroles-permissions/utils.ts, are exposed via the barrel (index.ts), andUserPermissionsimports them through it instead of reaching into library/. The expanded permissions view now enriches labels viagetPermissionMetadata, matching the matrix.Relocate messages from
RolesPermissions.tsx:The messages where still tightened to library despite of covering feature labeling.AI use acknowledgement
Supported by Claude Code