-
Notifications
You must be signed in to change notification settings - Fork 32
feat: Add event for LTI Launches #501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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. | ||
|
|
||
| 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) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason why we're duplicating user's the info?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
There was a problem hiding this comment.
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?