openedx.core.djangoapps.course_live package#
Subpackages#
Submodules#
openedx.core.djangoapps.course_live.apps module#
Configure the django app
- class openedx.core.djangoapps.course_live.apps.CourseLiveConfig(app_name, app_module)#
Bases:
AppConfigConfiguration class for Course Live.
- name = 'openedx.core.djangoapps.course_live'#
- plugin_app = {'url_config': {'cms.djangoapp': {'namespace': '', 'regex': '^api/course_live/', 'relative_path': 'urls'}, 'lms.djangoapp': {'app_name': 'openedx.core.djangoapps.course_live', 'namespace': '', 'regex': '^api/course_live/', 'relative_path': 'urls'}}}#
openedx.core.djangoapps.course_live.models module#
Models course live integrations.
- class openedx.core.djangoapps.course_live.models.CourseLiveConfiguration(*args, **kwargs)#
Bases:
TimeStampedModelAssociates a Course with a LTI provider and configuration
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- course_key#
DO NOT REUSE THIS CLASS. Provided for backwards compatibility only!
A placeholder class that provides a way to set the attribute on the model.
- created#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- enabled#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- free_tier#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- classmethod get(course_key)#
Lookup a course live configuration by course uuid.
- get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
- get_next_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=True, **kwargs)#
- get_previous_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=False, **kwargs)#
- get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
- history = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>#
- id#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- classmethod is_enabled(course_key) bool#
Check if there is an active configuration for a given course key
Default to False, if no configuration exists
- lti_configuration#
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- lti_configuration_id#
- modified#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>#
- provider_type#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- save_without_historical_record(*args, **kwargs)#
Save the model instance without creating a historical record.
Make sure you know what you’re doing before using this method.
openedx.core.djangoapps.course_live.permissions module#
API library for Django REST Framework permissions-oriented workflows
- class openedx.core.djangoapps.course_live.permissions.IsEnrolledOrStaff#
Bases:
BasePermissionCheck if user is enrolled in the course or staff
- has_permission(request, view)#
Return True if permission is granted, False otherwise.
- class openedx.core.djangoapps.course_live.permissions.IsStaffOrInstructor#
Bases:
BasePermissionCheck if user is global or course staff
Permission that checks to see if the user is global staff, course staff, course admin,If none of those conditions are met, HTTP403 is returned.
- has_permission(request, view)#
Return True if permission is granted, False otherwise.
openedx.core.djangoapps.course_live.plugins module#
openedx.core.djangoapps.course_live.providers module#
LTI Providers for course live module
- class openedx.core.djangoapps.course_live.providers.BigBlueButton#
Bases:
LiveProvider,HasGlobalCredentialsBig Blue Button LTI provider
- static get_global_keys() Dict#
Get keys from settings
- property has_free_tier: bool#
Check if free tier is enabled by checking for valid keys
- has_valid_global_keys() bool#
Check if keys are valid and not None
- id: str = 'big_blue_button'#
- property is_enabled: bool#
To check if provider is enabled To be implemented in subclasses
- name: str = 'Big Blue Button'#
- requires_username: bool = True#
- class openedx.core.djangoapps.course_live.providers.HasGlobalCredentials#
Bases:
ABCDefines structure for providers with global credentials
- static get_global_keys() Dict#
Get keys from settings
- has_valid_global_keys() bool#
Check if keys are valid and not None
- key: str#
- secret: str#
- url: str#
- class openedx.core.djangoapps.course_live.providers.LiveProvider#
Bases:
ABCDefines basic structure of lti provider
- additional_parameters: List[str] = []#
- features: List[str] = []#
- property has_free_tier: bool#
Property defines if provider has free tier
- id: str#
- property is_enabled#
To check if provider is enabled To be implemented in subclasses
- name: str#
- requires_custom_email()#
Check if provider requires custom instructor email
- requires_email: bool = False#
- requires_pii_sharing()#
Check if provider requires any PII ie username or email
- requires_username: bool = False#
- class openedx.core.djangoapps.course_live.providers.ProviderManager#
Bases:
objectThis class provides access to all available provider objects
- get_enabled_providers() Dict[str, LiveProvider]#
Get Enabled providers
- providers: Dict[str, LiveProvider]#
openedx.core.djangoapps.course_live.serializers module#
Serializers for course live views.
- class openedx.core.djangoapps.course_live.serializers.CourseLiveConfigurationSerializer(*args, **kwargs)#
Bases:
ModelSerializerSerialize configuration responses
- class Meta#
Bases:
object- fields = ['course_key', 'provider_type', 'enabled', 'lti_configuration', 'pii_sharing_allowed', 'free_tier']#
- model#
alias of
CourseLiveConfiguration
- read_only_fields = ['course_key']#
- create(validated_data)#
Create a new CourseLiveConfiguration entry in model
- get_pii_sharing_allowed(instance)#
- to_representation(instance)#
Object instance -> Dict of primitive datatypes.
- update(instance: CourseLiveConfiguration, validated_data: dict) CourseLiveConfiguration#
Update and save an existing instance
- validate_free_tier(value)#
Validates free_tier attribute
- class openedx.core.djangoapps.course_live.serializers.LtiSerializer(*args, **kwargs)#
Bases:
ModelSerializerSerialize LtiConfiguration responses
- class Meta#
Bases:
object- extra_kwargs = {'lti_1p1_client_secret': {'write_only': True}}#
- fields = ['lti_1p1_client_key', 'lti_1p1_client_secret', 'lti_1p1_launch_url', 'version', 'lti_config']#
- model#
alias of
LtiConfiguration
- read_only = ['version']#
- create(validated_data)#
We have a bit of extra checking around this in order to provide descriptive messages when something goes wrong, but this method is essentially just:
return ExampleModel.objects.create(**validated_data)
If there are many to many fields present on the instance then they cannot be set until the model is instantiated, in which case the implementation is like so:
example_relationship = validated_data.pop(‘example_relationship’) instance = ExampleModel.objects.create(**validated_data) instance.example_relationship = example_relationship return instance
The default implementation also does not handle nested relationships. If you want to support writable nested relationships you’ll need to write an explicit .create() method.
- pii_sharing_allowed()#
Check if email and username sharing is required and allowed
- update(instance: LtiConfiguration, validated_data: dict) LtiConfiguration#
Create/update a model-backed instance
- validate_lti_config(value)#
Validates if lti_config contains all required data i.e. custom_instructor_email
openedx.core.djangoapps.course_live.tab module#
Configurations to render Course Live Tab
- class openedx.core.djangoapps.course_live.tab.CourseLiveTab(tab_dict)#
Bases:
LtiCourseLaunchMixin,TabFragmentViewMixin,EnrolledTabCourse tab that loads the associated LTI-based live provider in a tab.
- ROLE_MAP = {'instructor': 'Administrator', 'staff': 'Administrator', 'student': 'Student'}#
- allow_multiple = False#
- is_dynamic = True#
- classmethod is_enabled(course, user=None)#
Check if the tab is enabled.
- property link_func#
Returns a function that returns the course tab’s URL.
- priority = 42#
- title = 'Live'#
- type = 'lti_live'#
- openedx.core.djangoapps.course_live.tab.provider_is_zoom(course_key: CourseKey) bool#
Check if the provider exists and is Zoom.
- openedx.core.djangoapps.course_live.tab.user_is_staff_or_instructor(user: AbstractBaseUser, course: CourseBlock) bool#
Check if the user is a staff or instructor for the course.
openedx.core.djangoapps.course_live.urls module#
course live API URLs.
openedx.core.djangoapps.course_live.views module#
View for course live app
- class openedx.core.djangoapps.course_live.views.CourseLiveConfigurationView(**kwargs)#
Bases:
APIViewView for configuring CourseLive settings.
- authentication_classes = (<class 'edx_rest_framework_extensions.auth.jwt.authentication.JwtAuthentication'>, <class 'openedx.core.lib.api.authentication.BearerAuthenticationAllowInactiveUser'>, <class 'edx_rest_framework_extensions.auth.session.authentication.SessionAuthenticationAllowInactiveUser'>)#
- get(request: Request, course_id: str) Response#
Handle HTTP/GET requests
- permission_classes = (<class 'openedx.core.djangoapps.course_live.permissions.IsStaffOrInstructor'>,)#
- post(request, course_id: str) Response#
Handle HTTP/POST requests
- class openedx.core.djangoapps.course_live.views.CourseLiveIframeView(**kwargs)#
Bases:
APIViewA view for retrieving course live iFrame.
Path:
api/course_live/iframe/{course_id}/Accepts: [GET]
GET#
Returns
200: OK - Contains a course live zoom iframe.
401: The requesting user is not authenticated.
403: The requesting user lacks access to the course.
404: The requested course does not exist.
Response
In the case of a 200 response code, the response will be iframe HTML.
Example
- {
- “iframe”: “
- <iframe
id=’lti-tab-embed’ style=’width: 100%; min-height: 800px; border: none’ srcdoc=’{srcdoc}’ >
</iframe> “,
}
- authentication_classes = (<class 'edx_rest_framework_extensions.auth.jwt.authentication.JwtAuthentication'>, <class 'openedx.core.lib.api.authentication.BearerAuthenticationAllowInactiveUser'>, <class 'edx_rest_framework_extensions.auth.session.authentication.SessionAuthenticationAllowInactiveUser'>)#
- get(request, course_id: str, **_kwargs) Response#
Handle HTTP/GET requests
- permission_classes = (<class 'rest_framework.permissions.IsAuthenticated'>, <class 'openedx.core.djangoapps.course_live.permissions.IsEnrolledOrStaff'>)#
- class openedx.core.djangoapps.course_live.views.CourseLiveProvidersView(**kwargs)#
Bases:
APIViewRead only view that lists details of LIVE providers available for a course.
- authentication_classes = (<class 'edx_rest_framework_extensions.auth.jwt.authentication.JwtAuthentication'>, <class 'openedx.core.lib.api.authentication.BearerAuthenticationAllowInactiveUser'>, <class 'edx_rest_framework_extensions.auth.session.authentication.SessionAuthenticationAllowInactiveUser'>)#
- get(request, course_id: str, **_kwargs) Response#
A view for retrieving Program live IFrame .
Path:
api/course_live/providers/{course_id}/Accepts: [GET]
GET#
- Returns
200: Returns list of providers with active provider,
401: The requester is not authenticated.
403: The requester cannot access the specified course.
404: The requested course does not exist.
Response
In the case of a 200 response code, the response will be available live providers.
Example
- {
- “providers”: {
“active”: “zoom”, “available”: {
- ‘zoom’: {
‘name’: ‘Zoom LTI PRO’, ‘features’: []
}
}
}
}
- static get_provider_data(course_id: str) Dict#
Get provider data for specified course :param course_id: course key string :type course_id: str
- Returns:
course Live providers
- Return type:
Dict
- permission_classes = (<class 'openedx.core.djangoapps.course_live.permissions.IsStaffOrInstructor'>,)#