fix: Exempt LTI in safe-sessions enforcement

This LTI call was failing in unit tests when `ENFORCE_SAFE_SESSIONS` was
enabled. I'm not sure why we didn't see failures in production when the
toggle was enabled in config.
This commit is contained in:
Tim McCormack
2022-01-22 01:53:31 +00:00
parent 4624bb7c3e
commit fb1ad76e65

View File

@@ -16,6 +16,7 @@ from django.db import IntegrityError, transaction
from common.djangoapps.student.models import UserProfile
from lms.djangoapps.lti_provider.models import LtiUser
from openedx.core.djangoapps.safe_sessions.middleware import mark_user_change_as_expected
def authenticate_lti_user(request, lti_user_id, lti_consumer):
@@ -96,6 +97,7 @@ def switch_user(request, lti_user, lti_consumer):
# users by this point, but just in case we can return a 403.
raise PermissionDenied()
login(request, edx_user)
mark_user_change_as_expected(edx_user.id)
def generate_random_edx_username():