-
Notifications
You must be signed in to change notification settings - Fork 84
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
user_id
not set and send as expected
#217
Comments
Hi @sroertgen, Which release of the Open edX platform are you running? Can you try enabling that flag if it's available on your instance? |
Hello @giovannicimolin , thanks for the fast response! I'm running openedx:12.2.0 . I added my course to That gave me the opportunity to set the Still I only get |
Hello and a happy and successful new year! Do you have some tips on debugging this issue? I'm quite new to openedx and still digging my way through. If you have suggestions on how I can debug the LTI parameters and see where this goes wrong, I will be very grateful! Thank you! |
Looking at the studio logs, I get a lot deprecation warnings, so it might have something to do with that?
Just thinking out loud here and further investigating... |
So i found out the following, changing these lines: xblock-lti-consumer/lti_consumer/lti_xblock.py Lines 686 to 694 in 582597a
to: @property
def user_id(self):
"""
Returns the opaque anonymous_student_id for the current user.
"""
user_id = self.runtime.service(self, 'user').get_current_user().opt_attrs['edx-platform.user_id']
if user_id is None:
raise LtiError(self.ugettext("Could not get user id for current request"))
return str(user_id) gives me the current user_id as expected. (Btw I find this user service is poorly documented. In the XBlock API documentation there is just the notice that runtime.user_id is deprecated in favour of a new user service, but no links to that service: https://edx.readthedocs.io/projects/xblock/en/latest/runtime.html#xblock.runtime.Runtime.user_id) Some searching brought me here: https://github.com/openedx/XBlock/blob/master/xblock/reference/user_service.py where some properties are explained. Maybe I just the documentation part somewhere (please send it to me, if there is some :) ) |
Hi @sroertgen, sorry for the delay! I was on vacation for the past few weeks and I'm catching up now. I scheduled a ticket to look at this issue in my next sprint (starting Jan 11) and will get back to you once I start working on it. |
Hey @giovannicimolin, no problem! I hope you had a nice and relaxing time! If you want to know, what I changed, here is my fork: https://github.com/sroertgen/xblock-lti-consumer/blob/master/lti_consumer/lti_xblock.py Since I'm currently only interested in LTI1.1 I only changed the necessary parts to get that working. Maybe worth to point out: I didn't know exactly, what you were meaning with |
We also encountered this issue on Maple. |
If I understand this issue correctly, after reading Maple release note at https://edx.readthedocs.io/projects/open-edx-release-notes/en/latest/maple.html#lti-1-3-and-lti-advantage-support we have enabled |
This is not the best approach since the method you are modifying is supposed to return the anonymous user id and not the actual user id used by the platform. You're right about the user service though, the parameter currently being used is deprecated, so the proper usage would be similar to what you've used:
If you open a pull request with this change I can review and approve it. 😁
You are probably testing your code using studio, the runtime on studio will always return
|
@sroertgen Also, I checked your fork (diff here), and saw that you replaced the deprecated runtime methods with the new user service. I can review those changes if you want to contribute them back to the platform. |
Hey @giovannicimolin , thanks for clarifying! I will be happy to contribute them back and will prepare so (but it might take till the end of the week). Just one more quick question (being new to edx): What is your recommended devstack, which you would also use for reviewing? Is it the Open edX devstack or is there something else you can recommend? |
@sroertgen I personally use the Open edX devstack (https://github.com/openedx/devstack) - with a somewhat modified networking setup to test LTI 1.3 launches. |
Hello 👋,
I am running the tutor distribution of Open Edx (https://docs.tutor.overhang.io/) and trying to add an LTI component.
I followed these steps: https://edx.readthedocs.io/projects/edx-partner-course-staff/en/latest/exercises_tools/lti_component.html#enabling-and-using-lti-advantage-features
For the LTI component I want to pass the edx username to the LTI component. So here https://my-edx.de/admin/xblock_config/courseeditltifieldsenabledflag/ I added the respective course, which gives me the opportunity to set the flag "Request user's username" to
True
in my course.Following your guide to test LTI (https://github.com/edx/xblock-lti-consumer#lti-11) I always get
user_id=student
and not the current edx user. Am I still missing something here? What do I have to configure to get the current user passed on to my LTI component?Thank you!
The text was updated successfully, but these errors were encountered: