Commit 1455882b by lduarte1991

Allows username and user email to be sent to an LTI.

Currently, there is a way to do so via opening the LTI tool in a new
page, this removes the one line of code that specifies that it is the
only way to do it. It allows the iframe’d version of the tool to be
able to receive such information if necessary.
parent d1d44e7b
...@@ -206,9 +206,8 @@ class LTIFields(object): ...@@ -206,9 +206,8 @@ class LTIFields(object):
ask_to_send_username = Boolean( ask_to_send_username = Boolean(
display_name=_("Request user's username"), display_name=_("Request user's username"),
# Translators: This is used to request the user's username for a third party service. # Translators: This is used to request the user's username for a third party service.
# Usernames can only be requested if "Open in New Page" is set to True.
help=_( help=_(
"Select True to request the user's username. You must also set Open in New Page to True to get the user's information." "Select True to request the user's username."
), ),
default=False, default=False,
scope=Scope.settings scope=Scope.settings
...@@ -216,9 +215,8 @@ class LTIFields(object): ...@@ -216,9 +215,8 @@ class LTIFields(object):
ask_to_send_email = Boolean( ask_to_send_email = Boolean(
display_name=_("Request user's email"), display_name=_("Request user's email"),
# Translators: This is used to request the user's email for a third party service. # Translators: This is used to request the user's email for a third party service.
# Emails can only be requested if "Open in New Page" is set to True.
help=_( help=_(
"Select True to request the user's email address. You must also set Open in New Page to True to get the user's information." "Select True to request the user's email address."
), ),
default=False, default=False,
scope=Scope.settings scope=Scope.settings
...@@ -603,11 +601,10 @@ class LTIModule(LTIFields, LTI20ModuleMixin, XModule): ...@@ -603,11 +601,10 @@ class LTIModule(LTIFields, LTI20ModuleMixin, XModule):
except AttributeError: except AttributeError:
self.user_username = "" self.user_username = ""
if self.open_in_a_new_page: if self.ask_to_send_username and self.user_username:
if self.ask_to_send_username and self.user_username: body["lis_person_sourcedid"] = self.user_username
body["lis_person_sourcedid"] = self.user_username if self.ask_to_send_email and self.user_email:
if self.ask_to_send_email and self.user_email: body["lis_person_contact_email_primary"] = self.user_email
body["lis_person_contact_email_primary"] = self.user_email
# Appending custom parameter for signing. # Appending custom parameter for signing.
body.update(custom_parameters) body.update(custom_parameters)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment