enterprise.filters package#

Submodules#

enterprise.filters.accounts module#

Pipeline step for determining read-only account settings fields.

class enterprise.filters.accounts.AccountSettingsEnterpriseReadOnlyFieldsStep(filter_type, running_pipeline, **extra_config)#

Bases: PipelineStep

Adds SSO-managed fields to the read-only account settings fields set.

This step is intended to be registered as a pipeline step for the org.openedx.learning.account.settings.read_only_fields.requested.v1 filter.

When a user is linked to an enterprise customer whose SSO identity provider has sync_learner_profile_data enabled, the fields listed in settings.ENTERPRISE_READONLY_ACCOUNT_FIELDS are added to readonly_fields. The "name" field is only added when the user has an existing UserSocialAuth record for the enterprise IdP backend.

run_filter(readonly_fields, user)#

Add enterprise SSO-managed fields to the read-only fields set.

The original code migrated from openedx-platform can be distilled into 3 logical branches:

  1. If NO identify provider (IdP) has sync enabled → no readonly fields added.

  2. If one or more IdPs have sync enabled, AND user has social auth → append ALL readonly fields.

  3. If one or more IdPs have sync enabled, AND user has NO social auth → append readonly fields MINUS ‘name’.

Each return statement below is marked with the corresponding branch number.

Parameters:
  • readonly_fields (set) – current set of read-only account field names.

  • user (User) – the Django User whose account settings are being updated.

Returns:

updated pipeline data with readonly_fields key.

Return type:

dict

enterprise.filters.dashboard module#

Pipeline steps for the student dashboard filter.

class enterprise.filters.dashboard.DashboardContextEnricher(filter_type, running_pipeline, **extra_config)#

Bases: PipelineStep

Enrich the student dashboard context with enterprise-specific data.

Injects: enterprise_message, is_enterprise_user, and enterprise learner portal context keys.

run_filter(context: dict[str, Any], template_name: str) dict[str, Any]#

Inject enterprise data into the dashboard context.

enterprise.filters.grades module#

Pipeline step for enriching grade analytics event context.

class enterprise.filters.grades.GradeEventContextEnricher(filter_type, running_pipeline, **extra_config)#

Bases: PipelineStep

Enriches a grade analytics event context dict with the learner’s enterprise UUID.

This step is intended to be registered as a pipeline step for the org.openedx.learning.grade.context.requested.v1 filter.

If the user is enrolled in the given course through an enterprise, the enterprise UUID is added to the context under the key "enterprise_uuid". If the user has no enterprise course enrollment, the context is returned unchanged.

run_filter(context: dict, user_id: int, course_id: str) dict[str, Any]#

Add enterprise UUID to the event context if the user has an enterprise enrollment.

Parameters:
  • context (dict) – the event tracking context dict.

  • user_id (int) – the ID of the user whose grade event is being emitted.

  • course_id (str) – the course key for the grade event.

Returns:

updated pipeline data with the enriched context dict:

{
    "context": <enriched context>,
    "user_id": <unchanged>,
    "course_id": <unchanged>,
}

Return type:

dict

Module contents#

Filter pipeline step implementations for edx-enterprise openedx-filters integrations.