Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ Change Log
Unreleased
__________

[10.3.0] - 2025-05-23
---------------------

Added
~~~~~

* Added new ``LTI_PROVIDER_LAUNCH_SUCCESS`` event in learning.


[10.2.1] - 2025-05-13
---------------------

Expand Down
2 changes: 1 addition & 1 deletion openedx_events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
more information about the project.
"""

__version__ = "10.2.1"
__version__ = "10.3.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "launch_data",
"type": {
"name": "LtiProviderLaunchData",
"type": "record",
"fields": [
{
"name": "user",
"type": {
"name": "UserData",
"type": "record",
"fields": [
{
"name": "id",
"type": "long"
},
{
"name": "is_active",
"type": "boolean"
},
{
"name": "pii",
"type": {
"name": "UserPersonalData",
"type": "record",
"fields": [
{
"name": "username",
"type": "string"
},
{
"name": "email",
"type": "string"
},
{
"name": "name",
"type": "string"
}
]
}
}
]
}
},
{
"name": "course_key",
"type": "string"
},
{
"name": "usage_key",
"type": "string"
},
{
"name": "launch_params",
"type": {
"name": "LtiProviderLaunchParamsData",
"type": "record",
"fields": [
{
"name": "roles",
"type": "string"
},
{
"name": "context_id",
"type": "string"
},
{
"name": "user_id",
"type": "string"
},
{
"name": "extra_params",
"type": {
"type": "map",
"values": "string"
}
}
]
}
}
]
}
}
],
"namespace": "org.openedx.learning.lti_provider.launch.success.v1"
}
34 changes: 34 additions & 0 deletions openedx_events/learning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,3 +656,37 @@ class ExternalGraderScoreData:
module_id = attr.ib(type=str)
queue_key = attr.ib(type=str)
queue_name = attr.ib(type=str)


@attr.s(frozen=True)
class LtiProviderLaunchParamsData:
"""
Data required for a successful LTI launch.

Attributes:
roles (str): A comma-separated list of roles (as per LTI Spec) of the User.
context_id (str): An ID for the launch context of LTI content.
user_id (str): External (LTI) User ID of user performing the launch.
extra_params (dict): A dictionary of other optional launch parameters.
"""
roles = attr.ib(type=str)
context_id = attr.ib(type=str)
user_id = attr.ib(type=str)
extra_params = attr.ib(type=dict[str, str], factory=dict)


@attr.s(frozen=True)
class LtiProviderLaunchData:
"""
Class that encapsulates LTI data for an LTI launch event.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add the attrs description as well here?


Attributes:
user (UserData): The user data for the Open edX user initiating the launch.
course_key (CourseKey): The unique course ID for the course to which the launched content belongs.
usage_key (UsageKey): The usage key for the content being luanched via LtiProviderLaunchParamsData.
launch_params (LtiProviderLaunchParamsData): The LTI parameters used for the launch.
"""
user = attr.ib(type=UserData)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we're duplicating user's the info?

@xitij2000 xitij2000 Jun 30, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user data here is for the Open edX user, whereas the user in the LtiProviderLaunchParamsData is the remote user id received via LTI.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh great. Can we add that detail in the docstring?

course_key = attr.ib(type=CourseKey)
usage_key = attr.ib(type=UsageKey)
launch_params = attr.ib(type=LtiProviderLaunchParamsData)
13 changes: 13 additions & 0 deletions openedx_events/learning/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
DiscussionThreadData,
ExamAttemptData,
ExternalGraderScoreData,
LtiProviderLaunchData,
ORASubmissionData,
PersistentCourseGradeData,
ProgramCertificateData,
Expand Down Expand Up @@ -504,3 +505,15 @@
"score": ExternalGraderScoreData,
}
)


# .. event_type: org.openedx.learning.lti_provider.launch.success.v1
# .. event_name: LTI_PROVIDER_LAUNCH_SUCCESS
# .. event_description: emitted when a student accesses learning content via LTI
# .. event_data: LtiProviderLaunchData
LTI_PROVIDER_LAUNCH_SUCCESS = OpenEdxPublicSignal(
event_type="org.openedx.learning.lti_provider.launch.success.v1",
data={
"launch_data": LtiProviderLaunchData,
}
)