openedx.core.djangoapps.agreements package#

Submodules#

openedx.core.djangoapps.agreements.api module#

Agreements API

openedx.core.djangoapps.agreements.api.create_integrity_signature(username, course_id)#

Create an integrity signature. If a signature already exists, do not create a new one.

Parameters:
  • username (*) –

  • course_id (*) –

Returns:

  • IntegritySignature object

openedx.core.djangoapps.agreements.api.create_lti_pii_signature(username, course_id, lti_tools)#

Creates an lti pii tool signature. If the signature already exist, do not create a new one.

Parameters:
  • course_key (*) –

  • lti_tools (*) –

  • lti_tools_hash (*) –

Returns:

  • An LTIPIISignature, or None if a signature already exists.

openedx.core.djangoapps.agreements.api.get_integrity_signature(username, course_id)#

Get an integrity signature.

Parameters:
  • username (*) –

  • course_id (*) –

Returns:

  • An IntegritySignature object, or None if one does not exist for the user + course combination.

openedx.core.djangoapps.agreements.api.get_integrity_signatures_for_course(course_id)#

Get all integrity signatures for a given course.

Parameters:

course_id (*) –

Returns:

  • QuerySet of IntegritySignature objects (can be empty).

openedx.core.djangoapps.agreements.api.get_lti_pii_signature(username, course_id)#

Get the lti pii signature of a user in a course.

Parameters:
  • username (*) –

  • course_id (*) –

Returns:

  • An LTIPIISignature object, or None if one does not exist for the user + course combination.

openedx.core.djangoapps.agreements.api.get_pii_receiving_lti_tools(course_id)#

Get a course’s LTI tools that share PII.

Parameters:

course_id (*) –

Returns:

  • A List of LTI tools sharing PII.

openedx.core.djangoapps.agreements.api.user_lti_pii_signature_needed(username, course_id)#

Determines if a user needs to acknowledge the LTI PII Agreement.

Parameters:

username (*) –

Returns:

  • True if the user needs to sign a new acknowledgement.

  • False if the acknowledgements are up to date.

openedx.core.djangoapps.agreements.data module#

Public data structures for this app.

class openedx.core.djangoapps.agreements.data.LTIPIISignatureData(user: str, course_id: str, lti_tools: str, lti_tools_hash: str)#

Bases: object

Class that stores an lti pii signature

course_id: str#
lti_tools: str#
lti_tools_hash: str#
user: str#
class openedx.core.djangoapps.agreements.data.LTIToolsReceivingPIIData(lii_tools_receiving_pii: {})#

Bases: object

Class that stores data about the list of LTI tools sharing PII

lii_tools_receiving_pii: {}#

openedx.core.djangoapps.agreements.models module#

Agreements models

class openedx.core.djangoapps.agreements.models.IntegritySignature(*args, **kwargs)#

Bases: TimeStampedModel

This model represents an integrity signature for a user + course combination.

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.

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

user_id#
class openedx.core.djangoapps.agreements.models.LTIPIISignature(*args, **kwargs)#

Bases: Model

This model stores a user’s acknowledgement to share PII via LTI tools in a particular course.

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.

id#

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

lti_tools#

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

lti_tools_hash#

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

user_id#
class openedx.core.djangoapps.agreements.models.LTIPIITool(*args, **kwargs)#

Bases: Model

This model stores the relationship between a course and the LTI tools in the course that share PII.

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.

id#

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

lti_tools#

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

lti_tools_hash#

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>#
class openedx.core.djangoapps.agreements.models.ProctoringPIISignature(*args, **kwargs)#

Bases: Model

This model stores a user’s acknowledgment to share PII via proctoring in a particular course.

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.

id#

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>#
proctoring_provider#

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

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

user_id#

openedx.core.djangoapps.agreements.serializers module#

Serializers for the Agreements app

class openedx.core.djangoapps.agreements.serializers.IntegritySignatureSerializer(*args, **kwargs)#

Bases: ModelSerializer

Serializer for the IntegritySignature model

class Meta#

Bases: object

fields = ('username', 'course_id', 'created_at')#
model = <IntegritySignature: IntegritySignature object (None)>#

openedx.core.djangoapps.agreements.urls module#

URLs for the Agreements API

openedx.core.djangoapps.agreements.views module#

Views served by the Agreements app

class openedx.core.djangoapps.agreements.views.AuthenticatedAPIView(**kwargs)#

Bases: APIView

Authenticated API View.

authentication_classes = (<class 'rest_framework.authentication.SessionAuthentication'>, <class 'edx_rest_framework_extensions.auth.jwt.authentication.JwtAuthentication'>)#
permission_classes = (<class 'rest_framework.permissions.IsAuthenticated'>,)#
class openedx.core.djangoapps.agreements.views.IntegritySignatureView(**kwargs)#

Bases: AuthenticatedAPIView

Endpoint for an Integrity Signature /integrity_signature/{course_id}

Supports:

HTTP GET: Returns an existing signed integrity agreement (by course id and user)

HTTP GET

** Scenarios ** ?username=xyz returns an existing signed integrity agreement for the given user and course

HTTP POST
  • If an integrity signature does not exist for the user + course, creates one and returns it. If one does exist, returns the existing signature.

get(request, course_id)#

In order to check whether the user has signed the integrity agreement for a given course.

Should return the following:

username (str) course_id (str) created_at (str)

If a username is not given, it should default to the requesting user (or masqueraded user). Only staff should be able to access this endpoint for other users.

post(request, course_id)#

Create an integrity signature for the requesting user and course. If a signature already exists, returns the existing signature instead of creating a new one.

/api/agreements/v1/integrity_signature/{course_id}

Example response:
{

username: “janedoe”, course_id: “org.2/course_2/Run_2”, created_at: “2021-04-23T18:25:43.511Z”

}

openedx.core.djangoapps.agreements.views.is_user_course_or_global_staff(user, course_id)#

Return whether a user is course staff for a given course, described by the course_id, or is global staff.

Module contents#