feat: split read vs write authz checks for library updates - #39009
feat: split read vs write authz checks for library updates#39009wgu-taylor-payne wants to merge 1 commit into
Conversation
|
Thanks for the pull request, @wgu-taylor-payne! 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. |
0ffca0e to
bc06509
Compare
Use COURSES_VIEW_LIBRARY_UPDATES for read access (list/summary endpoints) and COURSES_MANAGE_LIBRARY_UPDATES for write access (sync/decline). Course Auditors can now view library update status in read-only mode while only Editors+ can sync or decline updates. Updates DownstreamListView, DownstreamSummaryView, and _load_accessible_block to use authz permissions with legacy fallback. ENG45-712
bc06509 to
ddc8f71
Compare
Description
Updates the downstream sync v2 endpoints to use
courses.view_library_updatesfor read access (list/summary) andcourses.manage_library_updatesfor write access (sync/decline).Previously, the list endpoint used
has_studio_read_access(legacy only, no authz integration), and the sync/decline endpoints usedhas_studio_write_access. This meant Course Auditors were blocked from even viewing library update status. Per the design in openedx/openedx-authz#283, auditors should see the library updates page in read-only mode.User roles impacted: Course Auditor — can now view (but not sync/decline) library updates when authz is enabled.
Changes:
cms/djangoapps/contentstore/rest_api/v2/views/downstreams.py:DownstreamListView.get: UseCOURSES_VIEW_LIBRARY_UPDATESfor course-filtered requestsDownstreamSummaryView.get: UseCOURSES_VIEW_LIBRARY_UPDATESinstead ofCOURSES_VIEW_COURSE_load_accessible_block: UseCOURSES_MANAGE_LIBRARY_UPDATESfor write,COURSES_VIEW_LIBRARY_UPDATESfor readhas_studio_read_access/has_studio_write_accessimportsRollback: Gated behind
AUTHZ_COURSE_AUTHORING_FLAG— disabling the flag triggers legacy fallback viauser_has_course_permission.Supporting information
courses.view_library_updatesenforcement in openedx-platform openedx-authz#398Testing instructions
AUTHZ_COURSE_AUTHORING_FLAGfor a course with library-linked componentscourse_auditorroleGET /api/contentstore/v2/downstreams/?course_id={course_id}→ 200GET /api/contentstore/v2/downstreams/{course_id}/summary→ 200POST /api/contentstore/v2/downstreams/{usage_key}/sync→ 404 (permission denied)course_editor→ sync should succeed (200 or 400 depending on upstream state)Deadline
None