LTI Custom Parameters and Passing the Username

LTI Custom Parameters and Passing the Username

Dyllan Latimer -
回帖数:11

I'm looking to pass the Username of a user using the LTI link... 


Is there any sort of template variable that we would be able to pass as a custom parameter for the LTI link, to dynamically pass the username of whoever is using the link? 


Is there any way to retrieve the username that wouldn't be too cumbersome to set up on the Moodle side of things?


Any advice on the best way to approach this would be awesome.

回复Dyllan Latimer

Re: LTI Custom Parameters and Passing the Username

Benjamin Riggs -

I'm guessing you would need to modify Moodle's LTI plugin code to do so.  Perhaps it would be easier to work with what Moodle already sends, which is user_id (unique per site, sequentially numbered starting at 2), lis_person_name_given, lis_person_name_family, lis_person_name_full, & lis_person_contact_email_primary?

I'm not sure what utility having the Moodle username would provide beyond these fields. Care to describe what you're wanting to do?

回复Benjamin Riggs

Re: LTI Custom Parameters and Passing the Username

Thomas Osman -


Hi Benjamin,

 

Thank you for the response.  At this point we need the username because of how our integration is currently configured with moodle web services in our mod to receive the student roster. The identifier through our web services is Username rather than the user_id that LTI passes by default.  In the near future the user_id passed through LTI is what we would use, however due to development timelines we need to do this as a stop gap since there would need to be more development done on our other products to fully support the LTI 1.1 standard for passing data back to Moodle. 

 

Basically this is how we want this to work in the interim, but surprisingly Moodle is the only LMS that we support which does not have the custom parameter -

 

Mod with Moodle web services is installed by the institution.

Users within the institution register their account and proprietary hardware information.

Our desktop software imports the roster via web services and joins the account server info by the institution name and Moodle Username.

回复Thomas Osman

Re: LTI Custom Parameters and Passing the Username

Kris Stokking -

Thomas,

You have 2 options - you can either:

1.  Create an LTI sub-type, and add the additional parameter via the sub-type.  However, this will not be possible until MDL-44902 is integrated (please vote!).  

2.  Modify mod/lti/locallib.php and add the custom parameter to the $requestparams, ideally under this corresponding code block.  

Option #2 not preferred because you would be modifying Core code, but it is going to be your fastest option.  If you are an experienced Moodle developer that's up to the task of supporting/maintaining a Core patch then it should be viable for you.

回复Kris Stokking

Re: LTI Custom Parameters and Passing the Username

Dirk Grunwald -
I have a similar question about integrating "echo360" with Moodle.


In our local set up, the echo360 tool uses a unique identifier ("identikey") that is a cross-campus unique id. That key was already used for the campus-wide D2L setup, and we're trying to set up echo360 with our departmental Moodle setup.

I've gone ahead and modified line 248 of mod/lti/locallib.php to emit "username" (which we set to be the identikey identifier) rather than the internal moodle ID (which is the row number from mdl_users, best as I can tell).

I'm uncomfortable keeping this change in our code based, but we can't control the echo360 install because they don't want to break integration with D2L.

What remains to resolve  https://tracker.moodle.org/browse/MDL-44902 to allow such integration?


回复Kris Stokking

Re: LTI Custom Parameters and Passing the Username

Richard Ma -

Hi Kris,

I would like to assign the user's username as a custom parameter passed to the LTI provider, which only recognizes "lis_person_sourcedid", so I need to put it as lis_person_moodle=$username.

Is there a way for the variable to expand to the current user's username?

Otherwise, how would I go about to create an LTI sub-type and add the additional parameter via the sub-type, to achieve the same functionality?

Sincerely,

Richard

回复Richard Ma

Re: LTI Custom Parameters and Passing the Username

John Okely -

$User.username should be what you need 微笑

回复John Okely

Re: LTI Custom Parameters and Passing the Username

Richard Ma -

Thank you for the reply John. I was able to return the username as the custom parameter "custom_lis_person_sourcedid". However, the parameter "lis_person_sourcedid= " is also returned, and always returns a blank line. The tool provider seems to only recognize the first instance of the variable, which is always empty, and not the custom variable that I have set up. Is there a way to remove "lis_person_sourcedid" since it always returns an empty value, or can I change the value it returns?

Thank you,

Richard

回复Richard Ma

Re: LTI Custom Parameters and Passing the Username

John Okely -

Hmm, that sounds like a bug to me. I can't think of a way around it. Perhaps report it to the tracker?

回复Benjamin Riggs

Re: LTI Custom Parameters and Passing the Username

Ben Hutchens -

Has anyone found a solution for this?

We have an LTI tool that pulls moodle username. There is a fix to the moodle code that will enable this but as we don't have access to the code, is there a way to manage this through UI/custom parameters? 

Many thanks

Ben 

回复Ben Hutchens

Re: LTI Custom Parameters and Passing the Username

bhavin patel -

Hi all,

I want to send user -> country, user -> ethnicity (custom field) or object -> property to an LTI provider. 

I am able to send a static value by adding into custom parameter section of the external tool. But how can I have a dynamic value be passed through LTI?

I tried as below but no luck.

lis_person_country=$user->country

lis_person_country=$User->country

lis_person_country=$user.country

Your help will be much appreciated.

Thanks

Bhavin


回复bhavin patel

Re: LTI Custom Parameters and Passing the Username

Carrie Bishop -

Hi Bhavin, 

Did you ever get this to work?  I am trying to pass a numeric user ID that isn't present in the default LTI launch and I'm wondering if it will be possible via a dynamic value, as you're describing. thanks!

Carrie