Repository navigation
Description
Description
ListInstructorTasks (POST /courses/<course_id>/instructor/api/list_instructor_tasks) lists the running instructor tasks of a course. It hasn't been migrated to AuthZ yet: it still checks only the legacy instructor.show_tasks permission. With authz.enable_course_authoring enabled for a course, access to it doesn't follow the user's AuthZ roles, unlike the endpoints already migrated (#485). The Instructor Dashboard MFE calls it to show the pending tasks list, so it should require courses.view_course_info.
Current Behavior
ListInstructorTasks (lms/djangoapps/instructor/views/api.py) uses permission_classes = (IsAuthenticated, permissions.InstructorPermission) with permission_name = permissions.SHOW_TASKS (course staff or data_researcher). It delegates to _list_instructor_tasks, which also has @require_course_permission(permissions.SHOW_TASKS). AuthZ is never consulted.
Expected Behavior
- With
authz.enable_course_authoringenabled for the course, the endpoint returns the task list to users who holdcourses.view_course_infoand403to everyone else. - With the flag disabled, access stays the same as today (
instructor.show_tasks).
Acceptance Criteria
-
ListInstructorTasksusesInstructorAuthzPermissionwithauthz_permissions = (COURSES_VIEW_COURSE_INFO.identifier,). -
permission_namestayspermissions.SHOW_TASKS, so the legacy check is unchanged when the flag is disabled. -
@require_course_permission(permissions.SHOW_TASKS)on_list_instructor_tasksdoesn't reapply the legacy check on top of AuthZ for this endpoint. - A user without
courses.view_course_infogets403in the standard format (error_code: permission_denied). - Tests cover a user with Course Admin, one with Course Staff and one without permission, with the flag enabled.
- Users with the equivalent legacy role and no AuthZ role keep their access.
- The other callers of
_list_instructor_tasks(for example the legacy GET path) keep their current behavior.
Technical Notes
- Follow the pattern of the endpoints already migrated in
lms/djangoapps/instructor/views/api_v2.py. SeeInstructorAuthzPermissioninlms/djangoapps/instructor/authz/permissions.py. - The default legacy check of
courses.view_course_infoinLEGACY_PERMISSION_CHECKSisinstructor.view_dashboard, which is broader thaninstructor.show_tasks. Keepingpermission_name = SHOW_TASKSon the view avoids widening legacy access. - The MFE (
frontend-app-instructor-dashboard,fetchPendingTasksinsrc/data/api.ts) shows pending tasks on the Course Info, Grading, Certificates and Data Downloads pages. A user who can open one of those tabs but lackscourses.view_course_infowill get403for the pending tasks list.
Out of Scope
InstructorTasks(GETtasks/<course_id>),ListEntranceExamInstructorTasks,InstructorTaskListViewandTaskStatusView.
Related Issues
- Part of Backend permission enforcement (LMS) #485 (backend permission enforcement in the LMS).
- Related to Enforcement: Course Info tab #487 (Course Info tab) and Enforcement: Grading tab #490 (Grading tab).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady for Development
Activity
[-]Enforce `courses.view_course_info` in `ListInstructorTasks[/-][+]Enforce `courses.view_course_info` in `ListInstructorTasks`[/+]