enterprise.api package#
Subpackages#
- enterprise.api.v1 package
- Subpackages
- enterprise.api.v1.views package
- Submodules
- enterprise.api.v1.views.analytics_summary module
- enterprise.api.v1.views.base_views module
- enterprise.api.v1.views.coupon_codes module
- enterprise.api.v1.views.enterprise_catalog_query module
- enterprise.api.v1.views.enterprise_course_enrollment module
- enterprise.api.v1.views.enterprise_customer module
- enterprise.api.v1.views.enterprise_customer_api_credentials module
- enterprise.api.v1.views.enterprise_customer_branding_configuration module
- enterprise.api.v1.views.enterprise_customer_catalog module
- enterprise.api.v1.views.enterprise_customer_invite_key module
- enterprise.api.v1.views.enterprise_customer_reporting module
- enterprise.api.v1.views.enterprise_customer_sso_configuration module
- enterprise.api.v1.views.enterprise_customer_user module
- enterprise.api.v1.views.enterprise_group module
- enterprise.api.v1.views.enterprise_subsidy_fulfillment module
- enterprise.api.v1.views.notifications module
- enterprise.api.v1.views.pending_enterprise_customer_user module
- enterprise.api.v1.views.plotly_auth module
- Module contents
- enterprise.api.v1.views package
- Submodules
- enterprise.api.v1.decorators module
- enterprise.api.v1.fields module
- enterprise.api.v1.permissions module
- enterprise.api.v1.serializers module
AdminNotificationSerializer
AnalyticsSummarySerializer
BaseEnterpriseCustomerInviteKeySerializer
CourseDetailSerializer
CourseRunDetailSerializer
EnrollmentsInfoSerializer
EnterpriseCatalogQuerySerializer
EnterpriseCourseEnrollmentReadOnlySerializer
EnterpriseCourseEnrollmentWithAdditionalFieldsReadOnlySerializer
EnterpriseCourseEnrollmentWriteSerializer
EnterpriseCustomerApiCredentialRegeneratePatchSerializer
EnterpriseCustomerApiCredentialSerializer
EnterpriseCustomerBasicSerializer
EnterpriseCustomerBrandingConfigurationSerializer
EnterpriseCustomerBrandingConfigurationSerializer.Meta
EnterpriseCustomerBrandingConfigurationSerializer.get_enterprise_customer()
EnterpriseCustomerBrandingConfigurationSerializer.get_enterprise_slug()
EnterpriseCustomerBrandingConfigurationSerializer.get_logo()
EnterpriseCustomerBrandingConfigurationSerializer.get_primary_color()
EnterpriseCustomerBrandingConfigurationSerializer.get_secondary_color()
EnterpriseCustomerBrandingConfigurationSerializer.get_tertiary_color()
EnterpriseCustomerBulkEnrollmentsSerializer
EnterpriseCustomerBulkSubscriptionEnrollmentsSerializer
EnterpriseCustomerCatalogDetailSerializer
EnterpriseCustomerCatalogSerializer
EnterpriseCustomerCatalogWriteOnlySerializer
EnterpriseCustomerCourseEnrollmentsListSerializer
EnterpriseCustomerCourseEnrollmentsSerializer
EnterpriseCustomerCourseEnrollmentsSerializer.Meta
EnterpriseCustomerCourseEnrollmentsSerializer.create()
EnterpriseCustomerCourseEnrollmentsSerializer.validate()
EnterpriseCustomerCourseEnrollmentsSerializer.validate_course_run_id()
EnterpriseCustomerCourseEnrollmentsSerializer.validate_lms_user_id()
EnterpriseCustomerCourseEnrollmentsSerializer.validate_tpa_user_id()
EnterpriseCustomerCourseEnrollmentsSerializer.validate_user_email()
EnterpriseCustomerIdentityProviderSerializer
EnterpriseCustomerInviteKeyPartialUpdateSerializer
EnterpriseCustomerInviteKeyReadOnlySerializer
EnterpriseCustomerInviteKeyWriteSerializer
EnterpriseCustomerReportingConfigurationSerializer
EnterpriseCustomerReportingConfigurationSerializer.Meta
EnterpriseCustomerReportingConfigurationSerializer.create()
EnterpriseCustomerReportingConfigurationSerializer.update()
EnterpriseCustomerReportingConfigurationSerializer.validate()
EnterpriseCustomerReportingConfigurationSerializer.validate_pgp_encryption_key()
EnterpriseCustomerSerializer
EnterpriseCustomerSerializer.Meta
EnterpriseCustomerSerializer.get_active_integrations()
EnterpriseCustomerSerializer.get_admin_users()
EnterpriseCustomerSerializer.get_branding_configuration()
EnterpriseCustomerSerializer.get_enterprise_customer_catalogs()
EnterpriseCustomerSerializer.get_enterprise_notification_banner()
EnterpriseCustomerSsoConfiguration
EnterpriseCustomerToggleUniversalLinkSerializer
EnterpriseCustomerUnlinkUsersSerializer
EnterpriseCustomerUserReadOnlySerializer
EnterpriseCustomerUserReadOnlySerializer.Meta
EnterpriseCustomerUserReadOnlySerializer.get_data_sharing_consent_records()
EnterpriseCustomerUserReadOnlySerializer.get_enterprise_group()
EnterpriseCustomerUserReadOnlySerializer.get_groups()
EnterpriseCustomerUserReadOnlySerializer.get_role_assignments()
EnterpriseCustomerUserWriteSerializer
EnterpriseGroupLearnersRequestQuerySerializer
EnterpriseGroupMembershipSerializer
EnterpriseGroupRequestDataSerializer
EnterpriseGroupSerializer
ImmutableStateSerializer
LearnerCreditEnterpriseCourseEnrollmentReadOnlySerializer
LicensedEnterpriseCourseEnrollmentReadOnlySerializer
LinkLearnersSerializer
PendingEnterpriseCustomerUserSerializer
ProgramDetailSerializer
ResponsePaginationSerializer
SiteField
SiteSerializer
UserSerializer
- enterprise.api.v1.urls module
- Module contents
- Subpackages
Submodules#
enterprise.api.filters module#
Filters for enterprise API.
- class enterprise.api.filters.EnterpriseCourseEnrollmentFilterBackend#
Bases:
BaseFilterBackend
Filter backend to return enrollments under the user’s enterprise(s) only.
Staff users will bypass this filter.
Non-staff users will receive enrollments under their linked enterprises, only if they have the enterprise.can_enroll_learners permission.
Non-staff users without the enterprise.can_enroll_learners permission will receive only their own enrollments.
- filter_queryset(request, queryset, view)#
Filter out enrollments if learner is not linked
- class enterprise.api.filters.EnterpriseCustomerInviteKeyFilterBackend#
Bases:
BaseFilterBackend
Filter backend to return invite keys under the user’s enterprise(s) only. Supports filtering by enterprise_customer_uuid.
Staff users will bypass this filter.
- filter_queryset(request, queryset, view)#
Return a filtered queryset.
- class enterprise.api.filters.EnterpriseCustomerUserFilterBackend#
Bases:
BaseFilterBackend
Allow filtering on the enterprise customer user api endpoint.
- filter_queryset(request, queryset, view)#
Apply incoming filters only if user is staff. If not, only filter by user’s ID.
- class enterprise.api.filters.EnterpriseLinkedUserFilterBackend#
Bases:
BaseFilterBackend
Filter backend to return user’s linked enterprises only
Staff users will bypass this filter.
Non-staff users will receive only their linked enterprises.
- filter_queryset(request, queryset, view)#
Filter out enterprise customer if learner is not linked
- class enterprise.api.filters.UserFilterBackend#
Bases:
BaseFilterBackend
Filter backend for any view that needs to filter against the requesting user’s ID.
Staff users will bypass this filter.
Non-staff users will receive only those objects that match their own user ID.
This requires that USER_ID_FILTER be set in the view as a class variable, to identify the object’s relationship to a user ID.
- filter_queryset(request, queryset, view)#
Filter only for the user’s ID if non-staff.
enterprise.api.pagination module#
Pagination helpers for enterprise api.
- class enterprise.api.pagination.PaginationWithFeatureFlags#
Bases:
DefaultPagination
Adds a
features
dictionary to the default paginated response provided by edx_rest_framework_extensions. Thefeatures
dict represents a collection of Waffle-based feature flags/samples/switches that may be used to control whether certain aspects of the system are enabled or disabled (e.g., feature flag turned on for all staff users but not turned on for real customers/learners).
- enterprise.api.pagination.get_paginated_response(data, request)#
Update pagination links in course catalog data and return DRF Response.
- Parameters:
data (dict) – Dictionary containing catalog courses.
request (HttpRequest) – Current request object.
- Returns:
DRF response object containing pagination links.
- Return type:
(Response)
enterprise.api.throttles module#
Throttle classes for enterprise API.
- class enterprise.api.throttles.BaseThrottle#
Bases:
UserRateThrottle
Base throttle class with common functionality.
- allow_request(request, view)#
Modify throttling for service users.
Updates throttling rate if the request is coming from the service user, and defaults to UserRateThrottle’s configured setting otherwise.
Updated throttling rate comes from DEFAULT_THROTTLE_RATES key in REST_FRAMEWORK setting. specific user throttling is specified in DEFAULT_THROTTLE_RATES by it’s corresponding key.
REST_FRAMEWORK = { 'DEFAULT_THROTTLE_RATES': { 'service_user': '50/day', 'high_service_user': '2000/minute', } }
- get_scope()#
Get the scope of the throttle.
- Raises:
NotImplementedError – Must be implemented by subclasses
- update_throttle_scope()#
Update throttle scope based on the specific subclass.
- class enterprise.api.throttles.HighServiceUserThrottle#
Bases:
BaseThrottle
A throttle for high service users.
- class enterprise.api.throttles.ServiceUserThrottle#
Bases:
BaseThrottle
A throttle allowing the service user to override rate limiting.
enterprise.api.urls module#
URL definitions for enterprise API endpoint.
enterprise.api.utils module#
Utility functions for the Enterprise API.
- enterprise.api.utils.assign_feature_roles(user)#
Add the ENTERPRISE_DASHBOARD_ADMIN_ROLE, ENTERPRISE_REPORTING_CONFIG_ADMIN_ROLE, ENTERPRISE_CATALOG_ADMIN_ROLE feature roles if the user does not already have them
- enterprise.api.utils.create_message_body(email, enterprise_name, number_of_codes=None, notes=None)#
Return the message body with extra information added by user.
- enterprise.api.utils.delta_format(current, prior)#
Formate delta of the given numbers.
If the delta is positive, number is ‘+10’. If negative, change nothing, it will come through as ‘-10’ by default.
- enterprise.api.utils.generate_prompt_for_learner_engagement_summary(engagement_data)#
Generate an OpenAI prompt to get the summary of learner engagement from engagement data.
- enterprise.api.utils.generate_prompt_for_learner_progress_summary(progress_data)#
Generate an OpenAI prompt to get the summary of learner progress from progress data.
- enterprise.api.utils.get_ent_cust_from_enterprise_customer_key(enterprise_customer_key)#
Get the enterprise customer id given an enterprise customer key.
- enterprise.api.utils.get_ent_cust_from_report_config_uuid(uuid)#
Get the enterprise customer id given an enterprise report configuration UUID.
- enterprise.api.utils.get_enterprise_customer_from_catalog_id(catalog_id)#
Get the enterprise customer id given an enterprise customer catalog id.
- enterprise.api.utils.get_enterprise_customer_from_enterprise_group_id(group_id)#
Get the enterprise customer id given an enterprise customer group id.
- enterprise.api.utils.get_enterprise_customer_from_user_id(user_id)#
Get the enterprise customer id given an user id
- enterprise.api.utils.get_service_usernames()#
Return the set of service usernames that are given extended permissions in the API.
- enterprise.api.utils.has_api_credentials_enabled(enterprise_uuid)#
Check whether the enterprise customer can access to api credentials or not
- enterprise.api.utils.percentage_format(number)#
Turn float representation of percentage into a cleaner format (0.89 -> 89%)
- enterprise.api.utils.set_application_name_from_user_id(user_id)#
Get the enterprise customer user’s name given a user id.
Module contents#
Python API for various enterprise functionality.
- enterprise.api.activate_admin_permissions(enterprise_customer_user)#
Activates admin permissions for an existing PendingEnterpriseCustomerAdminUser.
Specifically, the “enterprise_admin” system-wide role is assigned to the user and the PendingEnterpriseCustomerAdminUser record is removed.
Requires an EnterpriseCustomerUser record to exist which ensures the user already has the “enterprise_learner” role as a prerequisite.
- Parameters:
enterprise_customer_user – an EnterpriseCustomerUser instance