Repository navigation
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. |
70a526b to
ac947d1
Compare
6a8fae3 to
ee176dd
Compare
Migrate ChangeDueDateView, GradedSubsectionsView and UnitExtensionsView to InstructorAuthzPermission, following the shared infrastructure from openedx-authz#486. GET endpoints require courses.view_learner_extensions, the POST endpoint requires courses.manage_learner_extensions. Both already had a matching default legacy check registered in LEGACY_PERMISSION_CHECKS, so the existing permission_name on each view is reused unchanged as the fallback when the authz.enable_course_authoring flag is disabled for the course. Add DateExtensionsAuthzTest covering Course Admin, Course Staff, a user with no permission, AuthZ denying a legacy instructor, and the legacy path with the flag off, for all three endpoints. Closes openedx-authz#491.
…s in Date Extensions Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
LearnerView is shared with other tabs of the Instructor Dashboard MFE. It is migrated using only the Date Extensions permission, courses.view_learner_extensions, with VIEW_DASHBOARD as the legacy fallback. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ee176dd to
9a2ebdb
Compare
Description
Migrates the five endpoints behind the Date Extensions tab to the shared Instructor Dashboard AuthZ infrastructure, following the migration guide in
lms/djangoapps/instructor/authz/README.rst.With
authz.enable_course_authoringon,InstructorAuthzPermissionis the only permission check, so a user whose AuthZ role has no legacy equivalent but holds the date extensions permissions can use the whole tab. With the flag off, behavior is unchanged.Affected roles: Course Admin, Course Staff, legacy Instructor, legacy Staff, Course Limited Staff, Data Researcher, Beta Tester.
Endpoints (base path
/api/instructor/v2)/courses/<course_id>/graded_subsectionscourses.view_learner_extensionsVIEW_DASHBOARD/courses/<course_id>/unit_extensionscourses.view_learner_extensionsVIEW_DASHBOARD/courses/<course_id>/learners/<email_or_username>(learner search, shared with other tabs)courses.view_learner_extensionsVIEW_DASHBOARD/courses/<course_id>/change_due_datecourses.manage_learner_extensionsGIVE_STUDENT_EXTENSION/courses/<course_id>/instructor/api/reset_due_date(legacy v1, used by the tab to rescind an extension)courses.manage_learner_extensionsGIVE_STUDENT_EXTENSIONNotes
ResetDueDate: the MFE calls this legacy v1 endpoint to rescind an extension. It usedInstructorPermission, which only sees legacy roles, so it returned403for AuthZ-only users while the rest of the tab worked. The other legacy v1 views (change_due_date,show_unit_extensions,show_student_extensions) are not used by the MFE and are not migrated.permission_nameas the fallback.LEGACY_PERMISSION_CHECKSinlms/djangoapps/instructor/authz/legacy.pyalready maps both permissions to those checks (added in feat: enforce AuthZ permissions in the Instructor Dashboard API v2 #39255), so no new legacy-check code is needed.get_course_by_id, soInstructorAuthzPermissionis the single barrier. A user holding only the AuthZ permission gets access without any legacy role.viewdoes not implymanage: a user with onlycourses.view_learner_extensionsgets200on the three GETs and403onchange_due_date, and the other way around.compat.py), so they keep exactly the access they had. This includes the Data Researcher reaching the two GETs throughVIEW_DASHBOARDwhile the tab stays hidden for them; that is existing legacy behavior and is intentionally preserved here.date_extensionstab logic inserializers_v2.pywas already wired up in feat: enforce AuthZ permissions in the Instructor Dashboard API v2 #39255 and is not touched.403instead of404, as for any other course. Only a user who passes the check (global staff) reaches the view and gets the404. The existing tests are adjusted, and a403test is added per GET endpoint.Other changes
3.2.0.openedx_authz.authzinstead ofopenedx_authz.applets.*.Supporting Information
Testing Instructions
Enable
authz.enable_course_authoringfor a test course.Flag on. Call the five endpoints above as each of these users:
200on all five.200on the endpoints the permission covers (viewfor the three GETs,managefor the two POSTs).403on all five.200on all five. Data Researcher:200on the GETs,403on the POSTs. Beta Tester:403on all five (legacy rules).403.403(AuthZ wins over the legacy role).Flag off. Behavior is unchanged:
200on all five.200on the GETs,403on the POSTs.403.Run the tests:
Automated coverage added:
DateExtensionsAuthzTestcovers all five endpoints for Course Admin, Course Staff, no permission, AuthZ denying a legacy instructor, an AuthZ role without a legacy equivalent (including each permission held alone), Course Editor and Auditor, the legacy-equivalent roles with the flag on, each legacy role with the flag off, and that the flag off never queries AuthZ (is_user_allowed.assert_not_called()).Deadline
Willow
Concerns
LearnerViewis a shared endpoint:GET /api/instructor/v2/courses/<course_id>/learners/<email_or_username>(learner search) is also used by other tabs of the MFE, such as Grading and Special Exams. It is migrated here using only the Date Extensions permission,courses.view_learner_extensions, since that is the one this PR can justify. As a consequence, an AuthZ-only user (a role with no legacy equivalent) needs that permission to search learners, even from the other tabs. For example, a role that can manage grades but does not holdview_learner_extensionsgets403on the search. This behavior could change in the future by a product decision, for instance to accept the permissions of the other tabs too (authz_permissionsalready accepts several, any one is enough). Special Exams has no AuthZ permission yet.Other Information
list_instructor_tasksandget_student_enrollment_status. They still useInstructorPermission, so AuthZ-only users get403on them.masterbefore the openedx-authz3.2.0bump and the applet imports change in the Cohorts PR, so the same lines may need a trivial rebase depending on the merge order.