openedx.core.djangoapps.external_user_ids package#
Submodules#
openedx.core.djangoapps.external_user_ids.apps module#
External User ID Application Configuration
openedx.core.djangoapps.external_user_ids.models module#
Models for External User Ids that are sent out of Open edX
- class openedx.core.djangoapps.external_user_ids.models.ExternalId(*args, **kwargs)#
Bases:
TimeStampedModelExternal ids are sent to systems or companies outside of Open edX. This allows us to limit the exposure of any given id.
An external id is linked to an internal id, so that users may be re-identified if the external id is sent back to Open edX.
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- classmethod add_new_user_id(user, type_name)#
Creates an ExternalId for the User of the type_name provided :param user: User to create the ID for :param type_name: Name of the type of ExternalId :type type_name: str
- Returns:
Returns the external id that was created or retrieved (Bool): True if the External ID was created, False if it already existed
- Return type:
- classmethod batch_get_or_create_user_ids(users, type_name)#
Creates ExternalIds in batch.
Given a list of users and a type_name, this method creates new external ids for users that do not already have one. Then returns a dictionary mapping user id with corresponding external id.
- Parameters:
users – List of User to create the IDs for
type_name (str) – Name of the type of ExternalId
- Returns:
- None if fails, otherwise ExternalIds mapped by User.id
- {
user_id: ExternalId
}
- Return type:
dict
- created#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- external_id_type#
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.
- external_id_type_id#
- external_user_id#
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_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.
- 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>#
- 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.
- user#
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.
- classmethod user_has_external_id(user, type_name)#
Checks if a user has an ExternalId of the type_name provided :param user: User to search for :param type_name: Name of the type of ExternalId :type type_name: str
- Returns:
True if the user already has an external ID, False otherwise.
- Return type:
(Bool)
- user_id#
- class openedx.core.djangoapps.external_user_ids.models.ExternalIdType(*args, **kwargs)#
Bases:
TimeStampedModelExternalIdType defines the type (purpose, or expected use) of an external id. A user may have one id that is sent to Company A and another that is sent to Company B.
- CALIPER = 'caliper'#
- exception DoesNotExist#
Bases:
ObjectDoesNotExist
- LTI = 'lti'#
- exception MultipleObjectsReturned#
Bases:
MultipleObjectsReturned
- XAPI = 'xapi'#
- created#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- description#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- externalid_set#
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- 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.
- modified#
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name#
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>#
- 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.
Module contents#
edX Platform support for external user IDs.
This package will be used to support generating external User IDs to be shared with outside parties.