feat: add platform-level glob scope#289
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. |
4c6afcd to
f4eebe1
Compare
0bfd409 to
040c426
Compare
* refactor: rename glob_cls to org_glob_cls and add platform access check Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…se overview glob scope check
e7f2a69 to
7c34a40
Compare
|
Hi everyone! This PR is ready for review, however, I have a few questions related to this PR that I'd like to resolve. @mariajgrimaldi @MaferMazu @rodmgwgu @bmtcril
|
|
Hello @BryanttV, thanks for this PR. Regarding your questions:
As a cold answer, I'll say yes, probably we would need that. But it could be out of scope of this PR. I'll open an issue about it.
I think it is better to maintain the wildcard to be consistent when someone has permissions across the platform (for example, global staff), and it is easier to handle (because leaving it blank could mean other things). Notes from my first review: When I try to assign a user as a course_user on the platform, I get a bad request. Request: {
"users": [
"course_user"
],
"role": "course_user", // The role to add users to
"scope": "course-v1:*" // The scope to add users to
}Answer {
"role": [
"Role 'course_user' does not exist in scope 'course-v1:*'"
]
}We should be able to apply all course roles over this platform course's global scope, right? Another thing I found is that it is better to use |
Resolves: #268
Description
This PR adds platform-level glob scopes so role assignments can target all resources of a type across the entire platform, not just within a single organization or specific scope.
Problem
Org-level globs (
course-v1:OpenedX+*,lib:DemoX:*) grant access within one org. Some use cases need platform-wide coverage (e.g., a role on all courses everywhere) without assigning per-org globs.Solution
PlatformGlobDataandPlatformCourseOverviewGlobDatafor thecourse-v1:*pattern (all courses on the platform).ScopeMeta:org_glob_registry: org-wide patterns (renamed fromglob_registry)platform_glob_registry: platform-wide patternsIS_ORG_GLOB/IS_PLATFORM_GLOBflags whereIS_GLOBis derived from both.Additional changes
get_all_org_glob_namespaces,get_all_platform_glob_namespaces,get_all_registered_scopes)PlatformCourseOverviewGlobDataincluded inSCOPES_WITH_ADMIN_OR_SUPERUSER_CHECK|Related Pull Requests
Testing Instructions
To test these changes, you can check the REST API.
Use the
/api/authz/v1/roles/users/endpoint to add platform-level permissions:{ "users": [ "john" ], "role": "course_admin", "scopes": [ "course-v1:*" ] }Validate the permissions
/api/authz/v1/permissions/validate/me[ { "action": "courses.view_course_team", "scope": "course-v1:OpenedX+DemoX+DemoCourse" }, { "action": "courses.manage_course_updates", "scope": "course-v1:edunext+RBAC+2026" }, { "action": "courses.manage_advanced_settings", "scope": "course-v1:any-org+any-course+any-run" } ]Response
[ { "action": "courses.view_course_team", "scope": "course-v1:OpenedX+DemoX+DemoCourse", "allowed": true }, { "action": "courses.view_course_team", "scope": "course-v1:edunext+RBAC+2026", "allowed": true }, { "action": "courses.view_course_team", "scope": "course-v1:any-org+any-course+any-run", "allowed": true } ]Example scope keys
course-v1:*course-v1:OpenedX+*OpenedXcourse-v1:OpenedX+Demo+2026Merge checklist
Check off if complete or not applicable: