feat: add checkbox for platform-wide scope assigment#197
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 #197 +/- ##
==========================================
+ Coverage 97.66% 97.72% +0.06%
==========================================
Files 68 68
Lines 1668 1674 +6
Branches 441 441
==========================================
+ Hits 1629 1636 +7
+ Misses 39 38 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Testing behavior
|
bra-i-am
left a comment
There was a problem hiding this comment.
Thanks for this PR. I have one comment about the behavior and a recommendation about the code. Everything else is great!
| library: 'lib:*', | ||
| }; | ||
|
|
||
| export const getPlatformAggregateScopeKey = (contextType: string): string => { |
There was a problem hiding this comment.
I think the contextType can be guarded by typings; something like this could work
| export const getPlatformAggregateScopeKey = (contextType: string): string => { | |
| export const getPlatformAggregateScopeKey = (contextType: keyof typeof PLATFORM_AGGREGATE_SCOPE_KEYS): string => { |
This will also fix the typing from scope at
const scope = PLATFORM_AGGREGATE_SCOPE_KEYS[contextType];
below
| const { data: orgPerms } = useValidateUserPermissions(orgPermissionRequests); | ||
| const { data: perms } = useValidateUserPermissions(permissionRequests); | ||
|
|
||
| const hasPlatformPermission = !!contextType && (perms?.[0]?.allowed ?? false); |
There was a problem hiding this comment.
Is perms?.[0] safe enough? How do we always ensure this order?

Description
This PR enables platform-scoped permission assignment for libraries and courses. The permission system determines whether a user has Manage Team permissions across all courses (
courses-v1:*) or all libraries (lib:*) on the platform. If the user has the required platform-wide permissions, the UI displays a checkbox that allows them to grant the same platform-scoped permission level to another user.This changes complement the wizard UI, now that the backend support the option openedx/openedx-authz#343.
Testing instructions
Use the current branch.
Open admin console with a regular user with manage team permissions, such as course admin or library admin.
Click assign role and fill the form. The option should not be displayed in the scope list.
Open the console with a Django admin or staff.
Follow the assign role process. A checkbox All <scope> in Platform should be displayed. Select it and save.
A confirmation toast should be displayed. And a new row in the table should appear for the selected user and the wildcard in scopes: courses (
courses-v1:*) or libraries (lib:*)