openedx.core.djangoapps.credentials package

Contents

openedx.core.djangoapps.credentials package#

Subpackages#

Submodules#

openedx.core.djangoapps.credentials.api module#

Python APIs exposed by the credentials app to other in-process apps.

openedx.core.djangoapps.credentials.api.is_credentials_enabled()#

A utility function wrapping the is_learner_issurance_enabled utility function of the CredentialsApiConfig model. Intended to be an easier to read/grok utility function that informs the caller if use of the Credentials IDA is enabled for this Open edX instance.

openedx.core.djangoapps.credentials.apps module#

Credentials Configuration

class openedx.core.djangoapps.credentials.apps.CredentialsConfig(app_name, app_module)#

Bases: AppConfig

Configuration class for credentials Django app

name = 'openedx.core.djangoapps.credentials'#
plugin_app = {'settings_config': {'lms.djangoapp': {'common': {'relative_path': 'settings.common'}, 'devstack': {'relative_path': 'settings.devstack'}, 'production': {'relative_path': 'settings.production'}, 'test': {'relative_path': 'settings.test'}}}, 'signals_config': {'lms.djangoapp': {'receivers': [{'receiver_func_name': 'handle_grade_change', 'signal_path': 'openedx.core.djangoapps.signals.signals.COURSE_GRADE_CHANGED'}, {'receiver_func_name': 'handle_cert_change', 'signal_path': 'openedx.core.djangoapps.signals.signals.COURSE_CERT_CHANGED'}]}}}#
ready()#

Override this method in subclasses to run code when Django starts.

verbose_name = 'Credentials'#

openedx.core.djangoapps.credentials.helpers module#

Helpers for the credentials service.

openedx.core.djangoapps.credentials.helpers.is_learner_records_enabled()#
openedx.core.djangoapps.credentials.helpers.is_learner_records_enabled_for_org(org)#

openedx.core.djangoapps.credentials.models module#

Models for credentials support for the LMS and Studio.

class openedx.core.djangoapps.credentials.models.CredentialsApiConfig(*args, **kwargs)#

Bases: ConfigurationModel

Manages configuration for connecting to the Credential service and using its API.

API_NAME = 'credentials'#
CACHE_KEY = 'credentials.api.data'#
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

OAUTH2_CLIENT_NAME = 'credentials'#
cache_ttl#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

change_date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

changed_by#

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.parent is a ForwardManyToOneDescriptor instance.

changed_by_id#
enable_learner_issuance#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

enable_studio_authoring#

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.

static get_internal_api_url_for_org(org)#

Internally-accessible API URL root, looked up by org rather than the current request.

get_next_by_change_date(*, field=<django.db.models.fields.DateTimeField: change_date>, is_next=True, **kwargs)#
get_previous_by_change_date(*, field=<django.db.models.fields.DateTimeField: change_date>, is_next=False, **kwargs)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property internal_api_url#

Internally-accessible API URL root, looked up based on the current request.

internal_service_url#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property is_cache_enabled#

Whether responses from the Credentials API will be cached.

property is_learner_issuance_enabled#

Returns boolean indicating if credentials should be issued.

property public_api_url#

Publicly-accessible API URL root.

property public_records_url#

Publicly-accessible Records URL root.

public_service_url#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class openedx.core.djangoapps.credentials.models.NotifyCredentialsConfig(*args, **kwargs)#

Bases: ConfigurationModel

Manages configuration for a run of the notify_credentials management command.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

arguments#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

change_date#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

changed_by#

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.parent is a ForwardManyToOneDescriptor instance.

changed_by_id#
enabled#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_change_date(*, field=<django.db.models.fields.DateTimeField: change_date>, is_next=True, **kwargs)#
get_previous_by_change_date(*, field=<django.db.models.fields.DateTimeField: change_date>, is_next=False, **kwargs)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

openedx.core.djangoapps.credentials.signals module#

This file contains signal handlers for credentials-related functionality.

openedx.core.djangoapps.credentials.signals.handle_cert_change(user, course_key, mode, status, **kwargs)#

Notifies the Credentials IDA about certain grades it needs for its records, when a cert changes.

openedx.core.djangoapps.credentials.signals.handle_grade_change(user, course_grade, course_key, **kwargs)#

Notifies the Credentials IDA about certain grades it needs for its records, when a grade changes.

openedx.core.djangoapps.credentials.utils module#

Helper functions for working with Credentials.

openedx.core.djangoapps.credentials.utils.get_credentials(user: User, program_uuid: str = None, credential_type: str = None, raise_on_error: bool = False) List[Dict]#

Given a user, get credentials earned from the credentials service.

Parameters:

user (User) – The user to authenticate as when requesting credentials.

Keyword Arguments:
  • program_uuid (str) – UUID of the program whose credential to retrieve.

  • credential_type (str) – Which type of credentials to return (course-run or program)

  • raise_on_error (bool) – Reraise errors back to the caller, instead if returning empty results.

Returns:

list of dict, representing credentials returned by the Credentials service.

openedx.core.djangoapps.credentials.utils.get_credentials_api_base_url(org=None)#

Returns a credentials API base URL.

Parameters:

org (str) – Optional organization to look up the site config for, rather than the current request

openedx.core.djangoapps.credentials.utils.get_credentials_api_client(user) Session#

Returns an authenticated Credentials API client.

Parameters:

user (User) – The user to authenticate as when requesting credentials.

openedx.core.djangoapps.credentials.utils.get_credentials_records_url(program_uuid=None)#

Returns a URL for a given records page (or general records list if given no UUID). May return None if this feature is disabled.

Parameters:

program_uuid (str) – Optional program uuid to link for a program records URL

Module contents#

edX Platform support for credentials.

This package will be used as a wrapper for interacting with the credentials service.