enterprise.overrides package#
Submodules#
enterprise.overrides.branding module#
Pluggable override implementations for the platform’s branding API.
- class enterprise.overrides.branding.EnterpriseLearnerPortalLink#
Bases:
TypedDictRequired keys for the header’s enterprise learner portal link.
Mirrors
lms.djangoapps.branding.api.EnterpriseLearnerPortalLink.
- enterprise.overrides.branding.enterprise_learner_generic_name(prev_fn: Callable[[...], str], user: AbstractBaseUser) str#
Return the generic name configured by the learner’s enterprise customer.
An enterprise customer with
replace_sensitive_sso_usernameenabled hides its SSO learners’ real usernames behind a generic name. Every other learner – and every page where no generic name applies, such as 404 pages – delegates to the platform, which displays the learner’s own username.The hook takes no request: the current one comes from crum, which is populated by
CurrentRequestUserMiddlewareduring a request cycle only. Outside one – a management command, a celery task, a shell – it is None, and this delegates rather than calling the platform helper with nothing.Pluggable override hook point: - hook function: get_learner_display_username() - platform path: lms/djangoapps/branding/api.py
- Parameters:
prev_fn – the previous (default) implementation. Must be called, and its result returned, whenever no enterprise generic name applies – the platform’s callers render this result directly, with no fallback of their own.
user – the Django User object whose name is being displayed. Not necessarily the user making the request: the progress page displays the student being viewed, and the user dropdowns display the real user behind a masquerade.
- Returns:
the enterprise generic name, or whatever the previous implementation returns.
- Return type:
- enterprise.overrides.branding.enterprise_learner_portal_link(prev_fn: Callable[[...], EnterpriseLearnerPortalLink | None]) EnterpriseLearnerPortalLink | None#
Return a link to the learner portal of the current viewer’s enterprise customer.
Learners of a customer with the learner portal enabled see the portal’s logo in place of the site logo, and reach the portal from the header’s dashboard link. Every other learner, including anonymous visitors, delegates to the platform, which supplies no portal.
The hook takes no arguments at all: it is about the current viewer, so crum supplies everything. crum is populated by
CurrentRequestUserMiddlewareduring a request cycle only; outside one it is None, and this delegates rather than calling the platform helper with nothing.Pluggable override hook point: - hook function: get_enterprise_learner_portal_link() - platform path: lms/djangoapps/branding/api.py
- Parameters:
prev_fn – the previous (default) implementation. Must be called, and its result returned, whenever the viewer has no portal-enabled customer.
- Returns:
the portal’s absolute URL, logo and name, or whatever the previous implementation returns.
- Return type:
dict or None
enterprise.overrides.course_home_progress module#
Pluggable override implementation for the course home progress view.
- enterprise.overrides.course_home_progress.enterprise_obfuscated_username(prev_fn, request, student)#
Return an enterprise-specific generic name for the student, or None.
When an enterprise SSO learner has a configured generic name, that name is returned so the learner’s real username is not exposed in the progress tab.
Pluggable override hook point: - hook function: obfuscated_username() - platform path: lms/djangoapps/course_home_api/progress/views.py
- Parameters:
prev_fn – the previous (default) implementation. Unused; retained for pluggable-override signature compatibility.
request – the current HTTP request.
student – the Django User object for the student being viewed.
- Returns:
the generic enterprise name, or None if the learner is not an enterprise SSO user with a configured generic name.
- Return type:
str or None
enterprise.overrides.learner_home module#
Pluggable override implementation for the learner home enterprise customer lookup.
- class enterprise.overrides.learner_home.EnterpriseCustomerData#
Bases:
TypedDictRequired keys for the learner home enterprise dashboard.
Mirrors
lms.djangoapps.learner_home.views.EnterpriseCustomerData
- enterprise.overrides.learner_home.enterprise_get_enterprise_customer(prev_fn, user: AbstractBaseUser, request: Request, is_masquerading: bool) EnterpriseCustomerData | None#
Return the enterprise customer dict for the given user, or None.
Pluggable override hook point: - hook function: get_enterprise_customer() - platform path: lms/djangoapps/learner_home/views.py
- Parameters:
prev_fn – the previous (default) implementation. Unused; retained for pluggable-override signature compatibility.
user – the Django User object.
request – the current HTTP request.
is_masquerading (bool) – True when the request is a staff masquerade.
- Returns:
enterprise customer data dict, or None if the user is not an enterprise customer user.
- Return type:
dict or None
enterprise.overrides.program_nudge_email module#
Pluggable override implementation for the program nudge email’s suggested course link.
- enterprise.overrides.program_nudge_email.enterprise_suggested_course_url(prev_fn: Callable[[...], str], user: AbstractBaseUser, suggested_course: dict, suggested_course_run: dict) str#
Return the B2B learner portal landing page for the nudge email’s suggested course.
A learner whose enterprise customer has the learner portal enabled is sent to that customer’s course landing page on the learner portal instead of the marketing site. Every other learner delegates to the platform, which supplies the ordinary course-about URL.
Pluggable override hook point: - hook function: get_suggested_course_url() - platform path: lms/djangoapps/program_enrollments/management/commands/send_program_course_nudge_email.py
- Parameters:
- Returns:
the learner portal course landing page fully-qualified URL.
- Return type:
enterprise.overrides.programs module#
Pluggable override implementation for the programs API.
- enterprise.overrides.programs.enterprise_get_enterprise_course_ids(prev_fn, enterprise_uuid: str, user: AbstractBaseUser) list[str]#
Return course IDs the given user is enterprise-enrolled in for the given enterprise customer.
This allows the platform’s programs list endpoint (GET /api/dashboard/v1/programs/{enterprise_uuid}/) to narrow a learner’s enrollments down to a single enterprise customer.
Pluggable override hook point: - hook function: get_enterprise_course_ids() - platform path: openedx/core/djangoapps/programs/rest_api/v1/views.py
- Parameters:
prev_fn – the previous (default) implementation. Unused.
enterprise_uuid (str) – UUID of the enterprise customer to filter enrollments by.
user – the Django User object.
- Returns:
course IDs (specifically, course keys) of the user’s enrollments under the given enterprise customer. Empty when the user has no such enrollments.
- Return type:
Module contents#
Pluggable override implementations for edx-enterprise.