feat: add platform glob scope support#38660
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. |
d723edb to
098c927
Compare
MaferMazu
left a comment
There was a problem hiding this comment.
Hello @BryanttV, thanks for this PR.
Regarding the functionality, this works as expected! ✅
I review it, and it looks good, just a small comment.
And to verify the test pass, we should use the hash of your last commit in openedx-authz (then you can change it again to v1.16.0).
799bee6 to
1c1cd49
Compare
1c1cd49 to
a0429c0
Compare
|
@MaferMazu, Thanks for the suggestion. I added a temporary commit to test the changes in |
2f904ba to
2fc06f0
Compare
2fc06f0 to
4a0ebbb
Compare
8a69af3 to
72e46d1
Compare
e5baeea to
3fda3a3
Compare
There was a problem hiding this comment.
@BryanttV, thanks for updating this PR.
Reading this PR again, I was wondering how checking the waffle flag by course will impact performance when a role assignment has platform scope, because we would check N courses in _get_course_keys_from_platform_scope.
What you implemented is a logic approach, but in terms of cost, perhaps we should check whether the waffle flag is enabled per platform (globally), since this global scope doesn't make much sense if the waffle flag is by course. What do you think?
Btw, the rest looks good to me.
1d3dd18 to
3d10399
Compare
|
Hi @MaferMazu! Thanks for your comment. I've been reviewing it, and I think the behavior should be exactly as it is. Even if the flag is enabled globally, it should still check if any course explicitly disabled it, right? In that case, that course_key shouldn't be returned. Let me know what you think. |
We are not doing it for orgs. If someone has org permissions, we are returning all the courses withouth checking them individually. But I understand what you said. In my opinion, we can live with the idea of a user with a course role on a platform being able to see the entire course list, but not have access to some courses, because it is a weird use case, and as I mentioned before, it doesn't make much sense to check by course a platform role. But if we want to be closer to correctness, I suggest we rethink Something we could do is exactly what you mentioned: check if the global flag is true, and then search for a course with a waffle flag set to off. And if the global flag is off, then search by course. What do you think about this idea? Note: My concern is that we should have a short circuit (something that helps us return something quickly) before that return, which will ask for all the courses on the platform. |
Yes, but here we are validating the course waffle flag: openedx-platform/cms/djangoapps/contentstore/views/course.py Lines 839 to 842 in 22512ba However, I do think we should have a short circuit. Here is what I propose:
What do you think? |
|
@BryanttV, that looks reasonable to me. |
3d10399 to
3cf3618
Compare
|
@MaferMazu, done, changes made! |
Resolves: openedx/openedx-authz#268
Resolves: openedx/openedx-authz#307
Description
This PR adds support for platform-wide scopes (
PlatformCourseOverviewGlobDataandPlatformContentLibraryGlobData) when resolving AuthZ permissions, so users with global access can see all courses (when the authz course-authoring feature flag is enabled) or content libraries.Related PRs
Testing instructions
Using Tutor:
Use the changes in feat: add platform-level glob scope openedx-authz#289 and feat: add platform-level glob scope for content libraries openedx-authz#333
Enable the
authz.enable_course_authoringflag globally, or in the courses or organizations of your choice.Create a new user.
Assign them course and content library permissions at the platform level using the
openedx-authzendpoint ({{lms_domain}}/api/authz/v1/roles/users/), e.g.:Content Libraries
{ "users": [ "john" ], "role": "library_admin", "scopes": [ "lib:*" ] }Courses
{ "users": [ "john" ], "role": "course_admin", "scopes": [ "course-v1:*" ] }Verify the course list in Studio. All courses with the flag enabled should appear.
Verify the content library list in Studio. All created libraries should appear.
Deadline
Verawood