[LON-CAPA-cvs] cvs: loncom /lti ltipassback.pm ltiroster.pm ltiutils.pm

raeburn raeburn at source.lon-capa.org
Sat Dec 9 11:24:04 EST 2017


raeburn		Sat Dec  9 16:24:04 2017 EDT

  Modified files:              
    /loncom/lti	ltiutils.pm ltiroster.pm ltipassback.pm 
  Log:
  - Sequential numbering of errors when requesting service from LTI Consumer
    to store grades or retrieve roster.
  
  
Index: loncom/lti/ltiutils.pm
diff -u loncom/lti/ltiutils.pm:1.1 loncom/lti/ltiutils.pm:1.2
--- loncom/lti/ltiutils.pm:1.1	Thu Dec  7 15:36:25 2017
+++ loncom/lti/ltiutils.pm	Sat Dec  9 16:24:03 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA LTI interactions 
 #
-# $Id: ltiutils.pm,v 1.1 2017/12/07 15:36:25 raeburn Exp $
+# $Id: ltiutils.pm,v 1.2 2017/12/09 16:24:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -290,7 +290,7 @@
                 if ($expected_sig eq $sigrec) {
                     return 1;
                 } else {
-                    $errors->{16} = 1;
+                    $errors->{17} = 1;
                 }
             } elsif ($context eq 'roster') {
                 my $uniqid = $digsymb.':::'.$cdom.'_'.$cnum;
@@ -298,14 +298,14 @@
                 if ($expected_sig eq $sigrec) {
                     return 1;
                 } else {
-                    $errors->{17} = 1;
+                    $errors->{18} = 1;
                 }
             }
         } else {
-            $errors->{18} = 1;
+            $errors->{19} = 1;
         }
     } else {
-        $errors->{19} = 1;
+        $errors->{20} = 1;
     }
     return;
 }
Index: loncom/lti/ltiroster.pm
diff -u loncom/lti/ltiroster.pm:1.1 loncom/lti/ltiroster.pm:1.2
--- loncom/lti/ltiroster.pm:1.1	Thu Dec  7 15:36:25 2017
+++ loncom/lti/ltiroster.pm	Sat Dec  9 16:24:03 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # LTI Consumer Module to respond to a course roster request.
 #
-# $Id: ltiroster.pm,v 1.1 2017/12/07 15:36:25 raeburn Exp $
+# $Id: ltiroster.pm,v 1.2 2017/12/09 16:24:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -85,7 +85,6 @@
     ($cdom,$cnum) = &LONCAPA::ltiutils::get_loncapa_course($r->dir_config('lonHostID'),
                                                            $cid,\%errors);
     unless ($cdom && $cnum) {
-        $errors{4} = 1;
         &invalid_request($r,\%errors);
         return OK;
     }
@@ -98,7 +97,7 @@
         &LONCAPA::ltiutils::get_tool_instance($cdom,$cnum,$digsymb,undef,\%errors);
 
     unless ($marker) {
-        $errors{5} = 1;
+        $errors{4} = 1;
         &invalid_request($r,\%errors);
         return OK;
     }
@@ -126,7 +125,6 @@
     unless (LONCAPA::ltiutils::verify_request($params,$protocol,$r->hostname,$r->uri,
                                               $env{'request.method'},$consumer_secret,
                                               \%errors)) {
-        $errors{6} = 1;
         &invalid_request($r,\%errors);
         return OK;
     }
@@ -137,7 +135,7 @@
 
     unless (&LONCAPA::ltiutils::check_nonce($params->{'oauth_nonce'},$params->{'oauth_timestamp'},
                                             $nonce_lifetime,$cdom,$r->dir_config('lonLTIDir'))) {
-        $errors{7} = 1;
+        $errors{16} = 1;
         &invalid_request($r,\%errors);
         return OK;
     }
@@ -149,7 +147,6 @@
 
     unless (&LONCAPA::ltiutils::verify_lis_item($rostersig,'roster',$digsymb,undef,$cdom,$cnum,
                                                 \%toolsettings,\%ltitools,\%errors)) {
-        $errors{8} = 1;
         &invalid_request($r,\%errors);
         return OK;
     }
@@ -165,7 +162,7 @@
     }
 
     unless (keys(%maproles)) {
-        $errors{9} = 1; 
+        $errors{21} = 1; 
         &invalid_request($r,\%errors);
         return OK;
     }
@@ -392,7 +389,7 @@
     my ($r,$errors) = @_;
     my $errormsg;
     if (ref($errors) eq 'HASH') {
-        $errormsg = join('&&',keys(%{$errors}));
+        $errormsg = join(',',keys(%{$errors}));
     }
     &Apache::loncommon::content_type($r,'text/xml');
     $r->send_http_header;
Index: loncom/lti/ltipassback.pm
diff -u loncom/lti/ltipassback.pm:1.2 loncom/lti/ltipassback.pm:1.3
--- loncom/lti/ltipassback.pm:1.2	Sat Dec  9 16:20:24 2017
+++ loncom/lti/ltipassback.pm	Sat Dec  9 16:24:03 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # LTI Consumer Module to receive grades passed back by Provider 
 #
-# $Id: ltipassback.pm,v 1.2 2017/12/09 16:20:24 raeburn Exp $
+# $Id: ltipassback.pm,v 1.3 2017/12/09 16:24:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -141,7 +141,7 @@
 
     unless (&LONCAPA::ltiutils::check_nonce($params->{'oauth_nonce'},$params->{'oauth_timestamp'},
                                             $ltitools{'lifetime'},$cdom,$r->dir_config('lonLTIDir'))) {
-        $errors{15} = 1;
+        $errors{16} = 1;
         &invalid_request($r,$params,\%errors);
         return OK;
     }
@@ -168,7 +168,7 @@
             %maproles = %{$ltitools{'roles'}};
         }
         unless (keys(%maproles)) {
-            $errors{20} = 1;
+            $errors{21} = 1;
             &invalid_request($r,$params,\%errors);
             return OK;
         }
@@ -205,12 +205,12 @@
             }
         }
         unless ($hasrole) {
-            $errors{21} = 1;
+            $errors{22} = 1;
             &invalid_request($r,$params,\%errors);
             return OK;
         }
     } else {
-        $errors{22} = 1;
+        $errors{23} = 1;
         &invalid_request($r,$params,\%errors);
         return OK;
     }
@@ -245,7 +245,7 @@
                      };
             }
             if ($@) {
-                $errors{22} = 1;
+                $errors{24} = 1;
                 &invalid_request($r,$params,\%errors);
                 return OK;
             }
@@ -288,16 +288,16 @@
                 if (($result eq 'ok') || ($result eq 'con_delayed')) {
                     &success($r,$params->{'sourcedid'},$resulttype,$result,$lang);
                 } else {
-                    $errors{23} = 1;
+                    $errors{25} = 1;
                     &invalid_request($r,$params,\%errors);
                 }
             }
         } else {
-            $errors{24} = 1;
+            $errors{26} = 1;
             &invalid_request($r,$params,\%errors);
         }
     } else {
-        $errors{25} = 1;
+        $errors{27} = 1;
         &invalid_request($r,$params,\%errors);
     }
     return OK;




More information about the LON-CAPA-cvs mailing list