Skip to content
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

issue/1163-lti-launch-similar-fields #1229

Open
wants to merge 1 commit into
base: dev/8-knights-of-the-round
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions fuel/app/modules/lti/classes/ltilaunch.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public static function from_request()
// these are configurable to let username and user_id come from custom launch variables
$consumer = trim(\Input::param('tool_consumer_info_product_family_code', false));
$remote_id_field = \Config::get("lti::lti.consumers.{$consumer}.remote_identifier", 'username');
$remote_user_field = \Config::get("lti::lti.consumers.{$consumer}.remote_username", 'user_id');

// trim all the roles
$roles = explode(',', \Input::param('roles'));
Expand All @@ -32,7 +31,6 @@ public static function from_request()
'fullname' => trim(\Input::param('lis_person_name_full', '')),
'roles' => $roles,
'remote_id' => trim(\Input::param($remote_id_field)),
'username' => trim(\Input::param($remote_user_field))
];

static::$launch = $vars;
Expand Down
16 changes: 8 additions & 8 deletions fuel/app/modules/lti/classes/ltiusermanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public static function authenticate($launch)
// Check for the test user first
if ($launch->first === 'Test' && $launch->last === 'Student' && in_array('Learner', $launch->roles))
{
$launch->username = $launch->remote_id = 'teststudent';
$launch->remote_id = 'teststudent';
$launch->email = "testuser@{$launch->consumer}.com";
$creates_users = true;
}

if (empty($launch->remote_id) || empty($launch->username) || empty($launch->consumer))
if (empty($launch->remote_id) || empty($launch->consumer))
{
Log::profile(['auth-data-missing', $launch->remote_id, $launch->username, $launch->consumer, \Input::param('resource_link_id')], 'lti');
Log::profile(['auth-data-missing', $launch->remote_id, $launch->consumer, \Input::param('resource_link_id')], 'lti');
return false;
}

Expand Down Expand Up @@ -93,7 +93,7 @@ public static function is_lti_user_a_content_creator($launch)
protected static function get_or_create_user($launch, $search_field, $auth_driver, $creates_users = false)
{
// allow any auth module that needs to look up external users to create them as needed
\Event::trigger('lti_get_or_create_user', $launch->username, 'json');
\Event::trigger('lti_get_or_create_user', $launch->remote_id, 'json');
$auth = \Auth::instance($auth_driver);

if ( ! $auth)
Expand All @@ -119,7 +119,7 @@ protected static function get_or_create_user($launch, $search_field, $auth_drive
{
//username, password, email, group, profile fields, first name, last name, requires password, requires email
$user_id = $auth->create_user(
$launch->username,
$launch->remote_id,
uniqid(),
$launch->email,
1,
Expand All @@ -139,15 +139,15 @@ protected static function get_or_create_user($launch, $search_field, $auth_drive

return $user;
}
Log::profile(['unable-to-create-user', $launch->username, $launch->email], 'lti-error');
Log::profile(['unable-to-create-user', $launch->remote_id, $launch->email], 'lti-error');
}
catch (\SimpleUserUpdateException $e)
{
Log::profile(['create-user-failed', $launch->username, $launch->email, $e->getMessage()], 'lti-error');
Log::profile(['create-user-failed', $launch->remote_id, $launch->email, $e->getMessage()], 'lti-error');
}
}

Log::profile(['unable-to-locate-user', $launch->username, $launch->email], 'lti-error');
Log::profile(['unable-to-locate-user', $launch->remote_id, $launch->email], 'lti-error');
return false;
}

Expand Down
1 change: 0 additions & 1 deletion fuel/app/modules/lti/config/heroku/lti.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

'consumers' => [
'canvas' => [
'remote_username' => $_ENV['LTI_USERNAME_PARAM'],
'remote_identifier' => $_ENV['LTI_USERNAME_PARAM'],
'secret' => $_ENV['LTI_SECRET'],
'key' => $_ENV['LTI_KEY'],
Expand Down
5 changes: 0 additions & 5 deletions fuel/app/modules/lti/config/lti.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
// the platform that this lti consumer is intended to match up with
'platform' => 'canvas.instructure.com',

// Choose the key value of an LTI paramater to use as our username
// In this case the value of lis_person_sourceid may be 'dave'. We will try to match username = 'dave'
'remote_username' => 'lis_person_sourcedid',

// When looking or creating local users based on the external system, what fields do we use as an identifier?
// remote_identifier is the name of the lti data sent
// local_identifier is the name of the user object property that we will match the remote identifier against
Expand Down Expand Up @@ -76,7 +72,6 @@
'title' => 'Materia Widget Assignment',
'description' => 'Add a Materia Widget to your Learning Module',
'platform' => 'obojobo.ucf.edu',
'remote_username' => 'lis_person_sourcedid',
'remote_identifier' => 'lis_person_sourcedid',
'local_identifier' => 'username',
'creates_users' => true,
Expand Down
1 change: 0 additions & 1 deletion fuel/app/modules/lti/config/test/lti.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
'title' => 'Materia Widget Test Assignment',
'description' => 'Add a Materia Widget to your Learning Module',
'platform' => 'materia.test.edu',
'remote_username' => 'lis_person_sourcedid',
'remote_identifier' => 'lis_person_sourcedid',
'local_identifier' => 'username',
'creates_users' => true,
Expand Down