Skip to content
Merged
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
12 changes: 12 additions & 0 deletions conf/authen_LTI.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ $preferred_source_of_username = "lis_person_contact_email_primary";

#$strip_address_from_email = 1;

################################################################################
# LTI Preferred source of Student Id
################################################################################

# If preferred_source_of_student_id is not set, WeBWorK will look in the LTI
# parameter 'custom_student_id.' If preferred_source_of_student_id is set, then
# WeBWorK will look in the LTI parameter specified below. This parameter may be
# dependendent on the LMS. E.G., In D2L, student_id is stored in OrgDefinedId and
# the corresponding LTI parameter is called ext_d2l_orgdefinedid.

#$preferred_source_of_student_id = "ext_d2l_orgdefinedid";

################################################################################
# LTI Basic Authentication Parameters
################################################################################
Expand Down
13 changes: 12 additions & 1 deletion lib/WeBWorK/Authen/LTIAdvanced.pm
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ sub get_credentials {
['oauth_timestamp', 'oauth_timestamp'],
['section', 'custom_section'],
['recitation', 'custom_recitation'],
['student_id', 'custom_student_id'],
);

# Some LMS's misspell the lis_person_sourcedid parameter name
Expand Down Expand Up @@ -199,14 +200,22 @@ sub get_credentials {
$self->{user_id} =~ s/@.*$// if
$ce->{strip_address_from_email};
}

if (!defined($self->{student_id})
and defined($ce->{preferred_source_of_student_id})) {
my $user_id_lti_param_name = $ce->{preferred_source_of_student_id};
$self->{student_id} = $r->param($user_id_lti_param_name);
}

# For setting up its helpful to print out what the system think the
# User id and address is at this point
if ( $ce->{debug_lti_parameters} ) {
warn "=========== summary ============";
warn "User id is |$self->{user_id}|\n";
warn "User mail address is |$self->{email}|\n";
warn "Student id is |", $self->{student_id}//'undefined',"|\n";
warn "preferred_source_of_username is |", $ce->{preferred_source_of_username}//'undefined',"|\n";
warn "preferred_source_of_student_id is |", $ce->{preferred_source_of_student_id}//'undefined',"|\n";
warn "================================\n";
}
if (!defined($self->{user_id})) {
Expand Down Expand Up @@ -518,6 +527,7 @@ sub create_user {
$newUser-> section($self->{section} // "");
$newUser->recitation($self->{recitation} // "");
$newUser->comment(formatDateTime(time, "local"));
$newUser->student_id($self->{student_id} // "");

# Allow sites to customize the user
if (defined($ce->{LTI_modify_user})) {
Expand Down Expand Up @@ -593,6 +603,7 @@ sub maybe_update_user {
$tempUser->status("C");
$tempUser-> section($self->{section} // "");
$tempUser->recitation($self->{recitation} // "");
$tempUser->student_id($self->{student_id} // "");

# Allow sites to customize the temp user
if (defined($ce->{LTI_modify_user})) {
Expand All @@ -601,7 +612,7 @@ sub maybe_update_user {

my @elements = qw(last_name first_name
email_address status
section recitation);
section recitation student_id);

my $change_made = 0;

Expand Down