Filters for enterprise API.
Bases: rest_framework.filters.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.
Return a filtered queryset.
Bases: rest_framework.filters.BaseFilterBackend
Allow filtering on the enterprise customer user api endpoint.
Apply incoming filters only if user is staff. If not, only filter by user’s ID.
Bases: rest_framework.filters.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 out enterprise customer if learner is not linked
Bases: rest_framework.filters.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 only for the user’s ID if non-staff.
Pagination helpers for enterprise api.
Update pagination links in course catalog data and return DRF Response.
data (dict) – Dictionary containing catalog courses.
request (HttpRequest) – Current request object.
DRF response object containing pagination links.
(Response)
Throttle classes for enterprise API.
Bases: rest_framework.throttling.UserRateThrottle
A throttle allowing the service user to override rate limiting.
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. service user throttling is specified in DEFAULT_THROTTLE_RATES by service_user key
Example Setting:
REST_FRAMEWORK = {
...
'DEFAULT_THROTTLE_RATES': {
...
'service_user': '50/day'
}
}
Update throttle scope so that service user throttle rates are applied.
URL definitions for enterprise API endpoint.
Utility functions for the Enterprise API.
Return the message body with extra information added by user.
Get the enterprise customer id given an enterprise customer key.
Get the enterprise customer id given an enterprise report configuration UUID.
Get the enterprise customer id given an enterprise customer catalog id.
Get the enterprise customer id given an user id
Return the set of service usernames that are given extended permissions in the API.
Python API for various enterprise functionality.
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.
enterprise_customer_user – an EnterpriseCustomerUser instance