Migrate Studio video endpoints to authz permissions
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- authorization
Línea de trabajo
Start with the asset permission pattern in cms/djangoapps/contentstore/asset_storage_handlers.py and the video entry points cms/djangoapps/contentstore/views/videos.py and cms/djangoapps/contentstore/video_storage_handlers.py. First resolve whether videos should reuse file permissions or get dedicated permissions; the issue identifies this as an open product and authz decision. Done means each listed endpoint enforces the appropriate read or write permission, legacy fallback remains, and tests cover roles and methods.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
The Studio video endpoints (/videos/<course_key> and related) do not use authz permissions. The ones that check access go through get_course_and_check_access, which only looks at legacy roles, so users with authz-only roles (e.g. Editor, Auditor) get 403. Even for legacy users, one check covers list, upload and delete, with no read/write distinction. Several related endpoints do not check course access at all.
Current Behavior
videos_handler(views/videos.py:97) →handle_videos→_get_and_validate_course(video_storage_handlers.py:634) →get_course_and_check_access(views/course.py:167) →has_studio_read_access→get_user_permissions(common/djangoapps/student/auth.py:83).get_user_permissionsonly considers legacy roles (GlobalStaff,OrgInstructorRole,CourseInstructorRole, etc.).- GET (list), POST (upload) and DELETE share the same check. An Auditor would be able to upload and delete if they passed it.
generate_video_upload_link_handlerandvideo_encodings_downloadalso go through_get_and_validate_course, with the same legacy check.- Some endpoints have no course permission check, only login or authentication:
video_images_handler(handle_video_images): only@login_required; the course key is used only for the upload path.transcript_preferences_handler(handle_transcript_preferences): only@login_required.get_course_youtube_edx_videos_ids(get_course_youtube_edx_video_ids): onlyview_auth_classes(), and it reads the course structure.
- The comment in
_get_and_validate_coursesays "assume all studio users that have access to the course can upload videos".
Expected Behavior
All video endpoints enforce authz permissions, with read separated from write:
- Listing videos and downloading encodings requires view permission.
- Uploading, changing images/transcript preferences and deleting require the matching edit/create/delete permission.
- Users with authz-only roles work according to their permissions. Legacy behavior is unchanged when authz is not enabled for the course.
Steps to reproduce
- Log in as a user with an authz-only role (Editor or Auditor) and no legacy course role.
- Open
/videos/course-v1:Ax+Ax+2026(Studio, port 8001). - Observe the 403.
- (No-check endpoints) Log in as any authenticated user with no access to a course and POST to
/video_images/<course_key>/<edx_video_id>or/transcript_preferences/<course_key>; the request is not rejected for lack of course access.
Acceptance Criteria
- The permission model for videos is decided (see Proposed Solution) and any missing permissions are added to
openedx-authz. -
_get_and_validate_course(or its callers) usesuser_has_course_permissionwith an authz permission and the legacy fallback. - GET
videos_handlerandvideo_encodings_downloadrequire the view permission; POST andgenerate_video_upload_linkrequire create/edit; DELETE requires delete. -
video_images_handler,transcript_preferences_handlerandget_course_youtube_edx_videos_idscheck course permission. - Users without the right permission get 403; an Auditor cannot upload or delete.
- Legacy roles keep their current access when authz is disabled for the course.
- Tests are added or updated for each role and method.
Proposed Solution
Follow the pattern used by the assets handler (_authz_enforce_file_permissions in asset_storage_handlers.py:100): a minimum view permission, then create/edit/delete checks on top when enable_authz_course_authoring(course_key) is on, each with a LegacyAuthoringPermission fallback.
Open question: reuse the existing files permissions (COURSES_VIEW_FILES, COURSES_CREATE_FILES, COURSES_EDIT_FILES, COURSES_DELETE_FILES) or add dedicated video permissions. Videos live in the same "Files & Uploads"-style area for users, but the code comment mentions a future dedicated video-uploader role, so this needs a product/authz decision.
Technical Notes
- Files:
cms/djangoapps/contentstore/views/videos.py,cms/djangoapps/contentstore/video_storage_handlers.py,cms/urls.py:181. video_images_upload_enabledandget_video_featuresonly return feature flags and likely need no change.
Related Issues
Related to openedx/openedx-authz#286.
- Lenguaje dominante
- Python
- Estrellas
- 0
- Forks
- 10
- Merge medio
- 5 d 9 h
- PR fusionados (30 d)
- 24
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de openedx/openedx-authz
-
willow
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
openedx/openedx-authz#604 ·
Los mantenedores suelen responder en 1 día
-
willow
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
openedx/openedx-authz#597 ·
Los mantenedores suelen responder en 1 día
-
willow
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
openedx/openedx-authz#579 ·
Los mantenedores suelen responder en 1 día
-
Willow release testingPosiblemente ocupada @mariajgrimaldi la tomó hace 2 días. Abiertowillow
openedx/openedx-authz#609 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Update Willow BTR test descriptions for current AuthZ behaviorPosiblemente ocupada @mariajgrimaldi la tomó hace 2 días. Abiertowillow
openedx/openedx-authz#608 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de openedx/openedx-authz
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
adafruit/Fruit-Jam-OS#98 ·
-
python triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/semantic-kernel#14753 ·
Los mantenedores suelen responder en 5 días
-
area:cli area:configuration documentation priority:low size:small
Dificultad 1/5 1-3 horas Aptitud para principiantes 80/100
RonaldHensbergen/composable-data-stack#1222 ·
Los mantenedores suelen responder en 1 día
-
bug python
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
pvlib/pvlib-python#2939 ·
Los mantenedores suelen responder en 1 día