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:
PipelineStepAdds 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.v1filter.When a user is linked to an enterprise customer whose SSO identity provider has
sync_learner_profile_dataenabled, the fields listed insettings.ENTERPRISE_READONLY_ACCOUNT_FIELDSare added toreadonly_fields. The"name"field is only added when the user has an existingUserSocialAuthrecord 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:
If NO identify provider (IdP) has sync enabled → no readonly fields added.
If one or more IdPs have sync enabled, AND user has social auth → append ALL readonly fields.
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.
enterprise.filters.courseware module#
Pipeline steps for courseware-related openedx-filters contributed by the Enterprise app.
- class enterprise.filters.courseware.ActiveEnterpriseCheckStep(filter_type, running_pipeline, **extra_config)#
Bases:
PipelineStepDeny access when the learner’s active EnterpriseCustomer differs from the EnterpriseCustomer attached to their EnterpriseCourseEnrollment for this course.
Registered against
org.openedx.learning.courseware.access_checks.requested.v1. RaisesCoursewareAccessChecksRequested.PreventCoursewareAccessto deny access.- run_filter(user: Any, course_key: CourseKey) dict#
Abstract pipeline step runner.
Used to implement custom code that’ll be executed by OpenEdxPublicFilter’s pipeline runner. It must be implemented by child classes.
By design, the pipeline expects either of three (3) types of returns:
A dictionary with the arguments the method received. They can be modified in the process.
None. Returning this will stop the pipeline execution. The accumulated output until this moment will be returned.
An object different from a dict. Returning this will stop the pipeline execution. The accumulated output until this moment will be returned.
- class enterprise.filters.courseware.EnterpriseStartDateAccessFailureStep(filter_type, running_pipeline, **extra_config)#
Bases:
PipelineStepSubstitutes a more specific start-date access-error payload for enterprise learners.
Registered against
org.openedx.learning.course.start_date.validation_failed.v1. RaisesCourseStartDateValidationFailed.OverrideStartDateErrorwhen the request user is an enterprise learner enrolled via a subsidy for the given course. If the user is not an enterprise learner, the step is a no-op.- run_filter(course_key: CourseKey, start_date: datetime) dict#
Abstract pipeline step runner.
Used to implement custom code that’ll be executed by OpenEdxPublicFilter’s pipeline runner. It must be implemented by child classes.
By design, the pipeline expects either of three (3) types of returns:
A dictionary with the arguments the method received. They can be modified in the process.
None. Returning this will stop the pipeline execution. The accumulated output until this moment will be returned.
An object different from a dict. Returning this will stop the pipeline execution. The accumulated output until this moment will be returned.
enterprise.filters.dashboard module#
Pipeline steps for the student dashboard filter.
- class enterprise.filters.dashboard.DashboardContextEnricher(filter_type, running_pipeline, **extra_config)#
Bases:
PipelineStepEnrich the student dashboard context with enterprise-specific data.
Injects: enterprise_message, is_enterprise_user, and enterprise learner portal context keys.
enterprise.filters.discounts module#
Pipeline step for excluding certain learners from course discounts.
- class enterprise.filters.discounts.DiscountEligibilityEnterpriseStep(filter_type, running_pipeline, **extra_config)#
Bases:
PipelineStepMarks learners linked to an enterprise as ineligible for LMS-controlled discounts.
This step is intended to be registered as a pipeline step for the
org.openedx.learning.discount.eligibility.check.requested.v1filter.LMS-controlled discounts (such as the first-purchase offer) are not applicable to learners whose enrollment is managed by an enterprise. This step queries the enterprise learner status and, if the user qualifies, raises
DiscountIneligibleto halt the pipeline and prevent the discount from being applied.- run_filter(user: AbstractBaseUser, course_key: CourseKey) dict#
Raise
DiscountIneligibleif the user is an enterprise learner.- Parameters:
user (User) – the Django User being checked for discount eligibility.
course_key – identifies the course (passed through unchanged).
- Returns:
updated pipeline data (unchanged) when the user is not an enterprise learner.
- Return type:
- Raises:
DiscountEligibilityCheckRequested.DiscountIneligible – when the user is linked
to an enterprise, halting further pipeline processing. –
enterprise.filters.enrollment module#
Pipeline steps for the course enrollment filter.
- class enterprise.filters.enrollment.EnterpriseEnrollmentViewProcessor(filter_type, running_pipeline, **extra_config)#
Bases:
PipelineStepEnrollment pipeline step: notify enterprise API and record consent.
When an enterprise customer user enrolls in a course, this step calls the enterprise and consent API clients to post the enrollment and provide consent on behalf of the enterprise customer.
This step is intended to be registered as a pipeline step for the
org.openedx.learning.course.enrollment.view.started.v1filter.
enterprise.filters.grades module#
Pipeline step for enriching grade analytics event context.
- class enterprise.filters.grades.GradeEventContextEnricher(filter_type, running_pipeline, **extra_config)#
Bases:
PipelineStepEnriches 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.v1filter.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:
- Returns:
updated pipeline data with the enriched
contextdict:{ "context": <enriched context>, "user_id": <unchanged>, "course_id": <unchanged>, }
- Return type:
Module contents#
Filter pipeline step implementations for edx-enterprise openedx-filters integrations.