tl-its-umich-edu / my-learning-analytics

My Learning Analytics (MyLA)
Apache License 2.0
36 stars 39 forks source link

use LTI-provided image in user menu #979

Open lsloan opened 4 years ago

lsloan commented 4 years ago

When viewing MyLA via LTI launch, the user menu in the navigation bar shows only the first letter of the username.

Canvas sends a URL for the user's image in the LTI launch request parameters. For example (altered for security purposes):

LTI parameter
v1.1 (or v1.0?) "user_image" → https://secure.gravatar.com/avatar/6dfef1fe7699ed12923613495a899999?s=128&d=identicon

Refs: https://www.eduappcenter.com/docs/basics/post_parameters, https://www.imsglobal.org/specs/ltiv1p1/implementation-guide
v1.3 "picture" → https://umich.instructure.com/images/thumbnails/3820300/g8eJUgc3nDcPSGZtzgMIyEessdoenIgGAe199999

Ref: https://www.imsglobal.org/spec/lti/v1p3/

Why not use that image?

Further discussion (perhaps for another issue): When MyLA is embedded as an LTI app, does it even NEED to show the user menu?

pushyamig commented 4 years ago

I looked up the LTI 1.3 launch message, I can see launch variable that get a picture "picture": "https://canva.instructure.com/images/thumbnails/3999900/jd8dfjd8dker0dl9p

pushyamig commented 4 years ago

Currently we are not storing the LTI launch variables anywhere for LTIv1p0 after the launch happens. If this is needed then we need to store the information either in a Django scalable cache or in django_session table.

pushyamig commented 4 years ago

We can also store in Django request session as well but then we need to make the Gunicorn session as sticky session which would impact the load distribution which I want to avoid.

lsloan commented 4 years ago

Does this parameter or other values need to be stored in the session or anywhere? Can it just be used as the first letter of the user name is being used now?

I remember the discussion in a TL-Dev meeting yesterday about the possibility of using sessions for various data. Sessions initiated by LTI launches are being used by Lecture Capture and M-Write Peer Review if we need examples.

While a session could hold the user image URL, it might be worthwhile to store the URL in DB instead. Possibly as another column in the user table or another table with a relationship to the user table.

pushyamig commented 4 years ago

To my understanding we can store the LTI launch information as below

  1. request/response session request.session['image_URL`] = "https://wee.com"
  2. in django_session table
  3. or Django cache by adding Redis or MemCache layer

We could also store in DB user table or where ever the user info leaves.

I feel the option 1 we need to make the session sticky that's why I not inclined using it subsequent requests from users will only goes to same pod. I was told that load distribution will be effected.

lsloan commented 4 years ago

To my understanding we have can store the LTI launch information

I don't understand whether you mean we "have to" or "can" store the info.

pushyamig commented 4 years ago

I don't understand whether you mean we "have to" or "can" store the info. we can

jennlove-um commented 4 years ago

Is this the same as or related to #672?