openedx_authz.rest_api.v1.course_authoring package#

Submodules#

openedx_authz.rest_api.v1.course_authoring.pipeline module#

Pipeline steps implementing course-authoring visibility for REST authorization filters.

This is the isolated, opt-in implementation of the exception documented in docs/decisions/0016-rest-api-domain-ownership-boundary.rst and docs/decisions/0017-cross-domain-filtering-via-openedx-filters.rst. It’s the only place in openedx_authz that computes course-authoring-flag visibility, and it’s never registered unless a deployment’s OPEN_EDX_FILTERS_CONFIG explicitly wires it in, typically via a Tutor plugin patch. Deleting this file and the patch that registers it removes the mechanism entirely; no endpoint code depends on it existing.

class openedx_authz.rest_api.v1.course_authoring.pipeline.CourseAuthoringPermissionValidationFilter(filter_type, running_pipeline, **extra_config)

Bases: CourseAuthoringVisibilityFilter[list[ValidationItem]]

Deny permission results whose scopes are hidden, retaining every result.

Input items contains computed permission results:

[
    {
        "action": "courses.manage_course_team",
        "scope": "course-v1:DemoX+CS101+2024",
        "allowed": True,
    },
    {"action": "courses.manage_course_team", "allowed": True},
]

An absent, None, or empty scope represents an any-scope check and remains unchanged. Hidden scopes receive allowed=False; other fields are preserved.

class openedx_authz.rest_api.v1.course_authoring.pipeline.CourseAuthoringRoleAssignmentFilter(filter_type, running_pipeline, **extra_config)

Bases: CourseAuthoringVisibilityFilter[RoleAssignmentItems]

Exclude hidden scopes from validated assignment data before writes.

Input items contains a role, user identifiers, and one or more scopes:

{
    "role": "course_staff",
    "users": ["alice"],
    "scopes": ["course-v1:DemoX+CS101+2024", "course-v1:DemoX+*"],
}

Visible scopes remain in their original order. Each rejected user/scope pair produces a scope_not_available error.

class openedx_authz.rest_api.v1.course_authoring.pipeline.CourseAuthoringRoleRemovalFilter(filter_type, running_pipeline, **extra_config)

Bases: CourseAuthoringVisibilityFilter[RoleRemovalItems]

Exclude users from validated removal data when its scope is hidden.

Input items contains a role, user identifiers, and a single scope:

{
    "role": "course_staff",
    "users": ["alice"],
    "scope": "course-v1:DemoX+CS101+2024",
}

A hidden scope clears users and produces a scope_not_available error for each affected user. Visible scopes leave the data unchanged.

class openedx_authz.rest_api.v1.course_authoring.pipeline.CourseAuthoringVisibilityFilter(filter_type, running_pipeline, **extra_config)

Bases: PipelineStep, Generic[AuthorizationItems]

Share scope visibility and error accumulation across operations.

run_filter(items: AuthorizationItems, errors: list[dict], **kwargs) → dict

Apply the subclass’s transformation and preserve earlier pipeline errors.

Parameters:
  • items (AuthorizationItems) – Operation-specific input documented by the subclass.

  • errors (list[dict]) – Errors from earlier steps, preserved before new errors.

  • **kwargs – Additional pipeline arguments, unused by this step.

Returns:

Filtered items in the original shape and accumulated errors.

Return type:

dict

openedx_authz.rest_api.v1.course_authoring.pipeline.is_scope_visible(scope: ScopeData) → bool

Return whether a scope is visible under the course-authoring flag.

  • Library and other non-course scopes (e.g. lib:DemoX:CSPROB): always visible.

  • Concrete course (e.g. course-v1:DemoX+CS101+2024): full course/org/platform cascade via enable_authz_course_authoring(course_key).

  • Org-level course glob (e.g. course-v1:DemoX+*): org override, else platform default.

  • Platform-level course glob (course-v1:*): platform tier only, no course or org.

Parameters:

scope (ScopeData) – A resolved scope instance.

Returns:

True if the scope should count as visible.

Return type:

bool

openedx_authz.rest_api.v1.course_authoring.views module#

REST API view exposing Course Authoring data.

This is the one endpoint in openedx-authz whose data is not Authorization’s own, kept as a bounded, documented exception. See docs/decisions/0015-expose-course-authoring-waffle-flag-state-via-rest-api.rst and docs/decisions/0026-rest-api-domain-ownership-boundary.rst.

class openedx_authz.rest_api.v1.course_authoring.views.WaffleFlagStatesAPIView(**kwargs)

Bases: APIView

Simple API view that returns the waffle flag states from utils.get_waffle_flag_states.

Endpoints

  • GET: Retrieve the enablement state of the course-authoring waffle flag across different scopes.

Response Format

  • ‘global’ (bool): True if the global waffle flag is enabled.

  • ‘org_overrides’ (dict): Orgs with an organization-level override, as ‘on’ (forces the flag on) and ‘off’ (forces the flag off) lists.

  • ‘course_overrides’ (dict): Courses with a course-level override, split the same way.

Example Request

GET /api/authz/v1/waffle-flag-states/

authentication_classes = [<class 'edx_rest_framework_extensions.auth.jwt.authentication.JwtAuthentication'>, <class 'edx_rest_framework_extensions.auth.session.authentication.SessionAuthenticationAllowInactiveUser'>]
get(request: HttpRequest) → Response

Retrieve the enablement state of the course-authoring waffle flag across different scopes.

permission_classes = [<class 'rest_framework.permissions.IsAuthenticated'>, <class 'rest_framework.permissions.AllowAny'>]

Module contents#

REST API views exposing Course Authoring data.

This package holds the one documented exception to openedx-authz’s domain boundary. Decision item 3 in ADR 0026 places it in a subpackage named after the domain that owns this data. See ADR 0015 for why the exception exists and ADR 0026 for the domain-ownership determination.