Skip to content
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

Only upsert LMSUser on launches #6682

Merged
merged 1 commit into from
Sep 13, 2024
Merged

Only upsert LMSUser on launches #6682

merged 1 commit into from
Sep 13, 2024

Conversation

marcospri
Copy link
Member

We currently have access to User via request.user and that upserts User in practically every request.

That is itself is a questionable design but for LMSUser we definitely only want to update it from the data from the LMS, not data we have forwarded back to use in API calls.

Only upsert_lms_user in the two direct launches from the LMS, the "basic" launch and deep linking launches.

Testing

 select display_name, lti_V13_user_id from lms_user;
          display_name          |           lti_v13_user_id            
--------------------------------+--------------------------------------
 Hypothesis 101 Teacher Teacher | 3f25366d-ab34-4307-be21-3ea444559e82
(5 rows)

We currently have access to User via request.user and that upsert LMS
in practically every request.

That is itself is a questionable design but for LMSUser we definitely only want to
update it from the data from the LMS, not data we have forwarded back
to use in API calls.

Only upsert_lms_user in the two direct launches from the LMS, the "basic" launch and deep linking launches.
@@ -363,7 +363,7 @@ def get_lti_user(request) -> LTIUser | None:
if lti_user:
# Make a record of the user for analytics so we can map from the
# LTI users and the corresponding user in H
request.find_service(UserService).upsert_user(lti_user, request.lti_params)
request.find_service(UserService).upsert_user(lti_user)
Copy link
Member Author

Choose a reason for hiding this comment

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

Keep this method as it originally was

return user

def _upsert_lms_user(self, user: User, lti_params: LTIParams) -> LMSUser:
def upsert_lms_user(self, user: User, lti_params: LTIParams) -> LMSUser:
Copy link
Member Author

Choose a reason for hiding this comment

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

Make this public.

@marcospri marcospri marked this pull request as ready for review September 13, 2024 09:10
@marcospri marcospri requested a review from acelaya September 13, 2024 09:10
@marcospri marcospri merged commit 2e82ba5 into main Sep 13, 2024
9 checks passed
@marcospri marcospri deleted the fix-upsert-lms-user branch September 13, 2024 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants