Skip to content

Require an active account on the conforming authoring API viewsets #39357

Open

Description

@feanil

Rationale

ADR 0034 (docs/decisions/0034-unify-auth-oauth2-dot-v2.rst) says new endpoints take the platform default authentication classes unless there is a reason to deviate, and names SessionAuthenticationAllowInactiveUser as a deviation that has to be commented. The conforming authoring viewsets added under #38137 all carry that deviation so that an account that has not been activated yet can still use Studio from a fresh session. We've had mixed opinions over the years on whether an un-activated account should be able to do things in Studio. I'd like to standardize on requiring an active account for the authoring APIs, which is what #39229 already does for the course outline and what I've asked for on #39227 for grading.

Description

Today these viewsets set authentication_classes = (JwtAuthentication, SessionAuthenticationAllowInactiveUser) with a comment explaining the deviation:

  • cms/djangoapps/contentstore/rest_api/v2/views/textbooks.py
  • cms/djangoapps/contentstore/rest_api/v2/views/video_settings.py
  • cms/djangoapps/contentstore/rest_api/v3/views/home.py
  • cms/djangoapps/contentstore/rest_api/v3/views/course_details.py
  • cms/djangoapps/contentstore/rest_api/v4/views/home.py

Change: remove the authentication_classes line and its comment from each so the platform default applies, update the ADR 0034 note in each module docstring, and add a test per viewset that a session for an inactive account gets a 401. A JWT for an inactive account is not checked for activation under the platform default either, so JWT callers do not change.

Out of scope, preserved: the v0 and v1 endpoints these supersede keep their view_auth_classes decorator until they are removed under their DEPR entries. Nothing changes for active accounts.

Task list

  • Drop the override on the five viewsets above
  • Add an inactive-session 401 test on each
  • Update the module docstrings and ADR 0034 notes

Related: #38137

Activity

  1. feanil commented on Nov 9, 2026

    @feanil
    ContributorAuthor

    @taimoor-ahmed-1 @Faraz32123 What do you think about this?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions