Pagination helpers for enterprise api.
enterprise.api.pagination.get_paginated_response(data, request)¶Update pagination links in course catalog data and return DRF Response.
| Parameters: |
|
|---|---|
| Returns: | DRF response object containing pagination links. |
| Return type: | (Response) |
Permission classes for the Enterprise API.
enterprise.api.permissions.IsServiceUserOrReadOnly¶Bases: rest_framework.permissions.IsAuthenticated
This request is authenticated as a service user, or is a read-only request.
has_permission(request, view)¶Enforce that the user is authenticated. If the request isn’t read-only (unsafe), then deny permission unless the user is a service user.
Throttle classes for enterprise API.
enterprise.api.throttles.ServiceUserThrottle¶Bases: rest_framework.throttling.UserRateThrottle
A throttle allowing the service user to override rate limiting.
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. service user throttling is specified in DEFAULT_THROTTLE_RATES by service_user key
``` REST_FRAMEWORK = {
... ‘DEFAULT_THROTTLE_RATES’: {
... ‘service_user’: ‘50/day’}
update_throttle_scope()¶Update throttle scope so that service user throttle rates are applied.
Utility functions for the Enterprise API.
enterprise.api.utils.get_service_usernames()¶Return the set of service usernames that are given extended permissions in the API.