Skip to content

fix: allow Course Editors to check and import video transcripts - #39381

Open
efortish wants to merge 1 commit into
openedx:masterfrom
eduNEXT:ks/issue-597-transcripts-editor-access
Open

efortish wants to merge 1 commit into
openedx:masterfrom
eduNEXT:ks/issue-597-transcripts-editor-access

Conversation

@efortish

Copy link
Copy Markdown
Contributor

Description

Course Editors can't import YouTube transcripts in the video editor. Every /transcripts/* view loads its block through _get_item (cms/djangoapps/contentstore/views/transcripts_ajax.py), which checked the legacy has_course_author_access. Editors are AuthZ-only (no entry in LEGACY_COURSE_ROLE_EQUIVALENCES), so /transcripts/check returned 403 for them. The authoring MFE only shows the import card when that call returns command == "import" and ignores the failed request, so the option silently never appeared.

_get_item now uses user_has_course_permission(user, COURSES_EDIT_COURSE_CONTENT, course_key, LegacyAuthoringPermission.WRITE). When authz.enable_course_authoring is off for the course, this falls back to has_studio_write_access, which is exactly what has_course_author_access called, so legacy behavior doesn't change.

All views that go through _get_item (check, choose, rename, replace, upload, download) back the video editor, which already requires edit permission, so requiring it for all of them is consistent. The v0 and v1 REST transcript endpoints reuse check_transcripts and replace_transcripts, so they get the same behavior.

Roles impacted: Course Author. Course Editors can now check and import transcripts. Users without edit permission (e.g. Course Auditor) still get 403.

Supporting information

Testing instructions

Automated

New TestTranscriptsAuthz in cms/djangoapps/contentstore/views/tests/test_transcripts.py:

Case Expected
AuthZ on, Course Editor calls /transcripts/check 200
AuthZ on, Course Auditor calls /transcripts/check or /transcripts/replace 403
AuthZ off, legacy staff calls /transcripts/check 200
AuthZ off, user with no role calls /transcripts/check 403

Without the fix, the Editor case fails. test_transcripts.py (49 tests) and the v1 test_youtube_transcripts.py (66 tests) pass in full.

Manual (verified on a local Tutor devstack)

Ran against the running LMS and Studio over HTTP (LMS login, SSO into Studio, then the same GET /transcripts/<view>?data=... calls the video editor makes), on a video block with a YouTube source:

  1. Create a course with authz.enable_course_authoring enabled through a course override, and add a video component.
  2. Assign one user course_editor and another course_auditor in that course.
  3. As each user, call /transcripts/check and /transcripts/replace (import from YouTube).
  4. Repeat /transcripts/check on a course with the flag off, using a legacy course staff user and a user with no role.
Step Before (master) After (this PR)
Editor check (AuthZ on) 403 200
Editor replace / import (AuthZ on) 403 passes the permission check
Auditor check / replace (AuthZ on) 403 403
Legacy staff check (AuthZ off) 200 200
No role check (AuthZ off) 403 403

Note on the import step: in my devstack, YouTube doesn't return a caption track for any video ID, so replace ends with a 400 ("Can't get transcript link from Youtube") for both the Editor and a legacy course staff user. The Editor now gets exactly the same response as staff, so the permission part works. The 400 comes from the environment's access to YouTube, not from this change.

To check it in the UI: log in as a Course Editor on a course with the flag on, open the video editor for a video with a YouTube source that has captions, and the transcript import card should appear.

Deadline

None.

Other information

  • No migrations, no new settings.
  • Out of scope: the ticket's optional MFE item (show an error when checkTranscriptsForImport fails) lives in frontend-app-authoring and isn't part of this PR.

Every /transcripts/* view gets its block through _get_item, which checked
the legacy has_course_author_access. Course Editors have no legacy role,
so they got a 403 on /transcripts/check and the video editor never showed
the YouTube import option.

_get_item now checks courses.edit_course_content through
user_has_course_permission, with the legacy WRITE permission as fallback,
which is the same check as before when the AuthZ flag is off. All of these
views back the video editor, so requiring edit permission for all of them
matches what the editor already needs. The v0 and v1 REST transcript
endpoints reuse check_transcripts and replace_transcripts, so they get
the same behavior.

Fixes openedx/openedx-authz#597
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @efortish!

This repository is currently maintained by @openedx/wg-maintenance-openedx-platform-oncall.

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 approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To 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:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where 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:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Nov 17, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Nov 17, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

Allow Course Editors to import YouTube transcripts and surface errors

2 participants