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
itemscontains 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
scoperepresents an any-scope check and remains unchanged. Hidden scopes receiveallowed=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
itemscontains 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_availableerror.
- 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
itemscontains a role, user identifiers, and a single scope:{ "role": "course_staff", "users": ["alice"], "scope": "course-v1:DemoX+CS101+2024", }
A hidden scope clears
usersand produces ascope_not_availableerror 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.
- 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 viaenable_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:
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:
APIViewSimple 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.