[LON-CAPA-cvs] cvs: loncom /interface lonexttool.pm
raeburn
raeburn at source.lon-capa.org
Thu Jan 4 07:37:49 EST 2018
raeburn Thu Jan 4 12:37:49 2018 EDT
Modified files:
/loncom/interface lonexttool.pm
Log:
- Bug 6754 LON-CAPA as LTI Consumer
- lis_result_sourcedid and ext_ims_lis_memberships_id do not need to be
stored in exttools.db, as LTI Provider will store them.
- Check if digest_symb and digest_user have previously been stored in
exttools.db.
Index: loncom/interface/lonexttool.pm
diff -u loncom/interface/lonexttool.pm:1.16 loncom/interface/lonexttool.pm:1.17
--- loncom/interface/lonexttool.pm:1.16 Mon Jan 1 01:29:38 2018
+++ loncom/interface/lonexttool.pm Thu Jan 4 12:37:49 2018
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Launch External Tool Provider (LTI)
#
-# $Id: lonexttool.pm,v 1.16 2018/01/01 01:29:38 raeburn Exp $
+# $Id: lonexttool.pm,v 1.17 2018/01/04 12:37:49 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -274,8 +274,10 @@
unless (grep(/^\Q$ltirole\E$/, at possroles)) {
$ltirole = 'Learner';
}
+ my @possdigest;
my $digest_user = &Encode::decode_utf8($uname.':'.$udom);
$digest_user = &Digest::SHA::sha1_hex($digest_user);
+ push(@possdigest,$digest_user);
if ($env{'course.'.$env{'request.course.id'}.'.languages'} ne '') {
@userlangs=(@userlangs,split(/\s*(\,|\;|\:)\s*/,
$env{'course.'.$env{'request.course.id'}.'.languages'}));
@@ -298,6 +300,7 @@
if ($symb) {
$digest_symb = &Encode::decode_utf8($symb);
$digest_symb = &Digest::SHA::sha1_hex($digest_symb);
+ push(@possdigest,$digest_symb);
my $navmap = Apache::lonnavmaps::navmap->new();
if (ref($navmap)) {
my $res = $navmap->getBySymb($symb);
@@ -338,6 +341,11 @@
$crsprotocol = 'http';
}
if (($passback) || ($roster)) {
+ my (%currdigest,%digesthash);
+ if (@possdigest) {
+ %currdigest = &Apache::lonnet::get('exttools',\@possdigest,
+ $cdom,$cnum);
+ }
if ($passback) {
$ltiparams{'lis_outcome_service_url'} = $crsprotocol.'://'.$crshostname.'/adm/service/passback';
$ltiparams{'ext_ims_lis_basic_outcome_url'} = $ltiparams{'lis_outcome_service_url'};
@@ -355,18 +363,15 @@
}
}
}
- my %digesthash;
- if ($ltiparams{'lis_result_sourcedid'}) {
- $digesthash{$ltiparams{'lis_result_sourcedid'}} = "$idx\0".time;
- }
- if ($ltiparams{'ext_ims_lis_memberships_id'}) {
- $digesthash{$ltiparams{'ext_ims_lis_memberships_id'}} = "$idx\0".time;
- }
if (($digest_symb) && ($gradesecret || $rostersecret)) {
- $digesthash{$digest_symb} = $symb;
+ unless ((exists($currdigest{$digest_symb})) && ($currdigest{$digest_symb} eq $symb)) {
+ $digesthash{$digest_symb} = $symb;
+ }
}
if (($passback) && ($gradesecret)) {
- $digesthash{$digest_user} = $uname.':'.$udom;
+ unless ((exists($currdigest{$digest_user})) && ($currdigest{$digest_user} eq $uname.':'.$udom)) {
+ $digesthash{$digest_user} = $uname.':'.$udom;
+ }
}
if (keys(%digesthash)) {
&Apache::lonnet::put('exttools',\%digesthash,$cdom,$cnum);
More information about the LON-CAPA-cvs
mailing list