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
bc06509 to
ddc8f71
Compare
ddc8f71 to
f1dac98
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
f1dac98 to
2d48695
Compare
| if not user_has_course_permission( | ||
| request.user, | ||
| COURSES_VIEW_COURSE.identifier, | ||
| COURSES_VIEW_LIBRARY_UPDATES.identifier, |
There was a problem hiding this comment.
Out of curiosity. Why is this part of the changes?
68b9dea to
2d48695
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
AI Usage
Kiro was used as a development partner throughout this PR. I directed the implementation approach, defined scope, reviewed generated code, and made design decisions — Kiro researched the codebase, wrote the implementation and tests, ran lint/type checks, and iterated on fixes. I verified the changes manually against a local Tutor dev environment and reviewed the final diffs before submitting.