Diff for /loncom/lti/ltiauth.pm between versions 1.26 and 1.28

version 1.26, 2021/11/22 23:41:00 version 1.28, 2022/02/01 19:47:20
Line 495  sub handler { Line 495  sub handler {
     if ($sourcecrs ne '') {      if ($sourcecrs ne '') {
         %consumers = &Apache::lonnet::get_dom('lticonsumers',[$sourcecrs],$cdom);          %consumers = &Apache::lonnet::get_dom('lticonsumers',[$sourcecrs],$cdom);
         if (exists($consumers{$sourcecrs})) {          if (exists($consumers{$sourcecrs})) {
             if ($consumers{$sourcecrs} =~ /^$match_courseid$/) {              if ($consumers{$sourcecrs} =~ /^\Q$itemid:\E($match_courseid)$/) {
                 my $crshome = &Apache::lonnet::homeserver($consumers{$sourcecrs},$cdom);                  $storedcnum = $1;
                   my $crshome = &Apache::lonnet::homeserver($storedcnum,$cdom);
                 if ($crshome =~ /(con_lost|no_host|no_such_host)/) {                  if ($crshome =~ /(con_lost|no_host|no_such_host)/) {
                     &invalid_request($r,20);                      &invalid_request($r,20);
                     return OK;                      return OK;
                 } else {                  } else {
                     $posscnum = $consumers{$sourcecrs};                      $posscnum = $storedcnum;
                 }                  }
             }              }
         }          }
Line 640  sub handler { Line 641  sub handler {
 #  #
 # If LON-CAPA course is a Community, and LON-CAPA role  # If LON-CAPA course is a Community, and LON-CAPA role
 # indicated is cc, change role indicated to co.  # indicated is cc, change role indicated to co.
 #   #
   
     my %crsenv;      my %crsenv;
     if ($lcroles[0] eq 'cc') {      if ($lcroles[0] eq 'cc') {
Line 745  sub handler { Line 746  sub handler {
     }      }
   
 #  #
 # Store consumer-to-LON-CAPA course mapping  # Retrieve course type of LON-CAPA course to check if mapping from a Consumer
   # course identifier permitted for this type of course (one of: official,
   # unofficial, community, textbook, placement or lti.
   #
   
       unless (%crsenv) {
           %crsenv = &Apache::lonnet::coursedescription($cdom.'_'.$cnum);
       }
       my $crstype = lc($crsenv{'type'});
       if ($crstype eq '') {
           $crstype = 'course';
       }
       if ($crstype eq 'course') {
           if ($crsenv{'internal.coursecode'}) {
               $crstype = 'official';
           } elsif ($crsenv{'internal.textbook'}) {
               $crstype = 'textbook';
           } elsif ($crsenv{'internal.lti'}) {
               $crstype = 'lti';
           } else {
               $crstype = 'unofficial';
           }
       }
   
   #
   # Store consumer-to-LON-CAPA course mapping if permitted
 #  #
   
     if (($sourcecrs ne '')  && ($consumers{$sourcecrs} eq '') && ($cnum ne '')) {      if (($lti{$itemid}{'storecrs'}) && ($sourcecrs ne '') && 
         &Apache::lonnet::put_dom('lticonsumers',{ $sourcecrs => $cnum },$cdom);          ($consumers{$sourcecrs} eq '') && ($cnum ne '')) {
           if (ref($lti{$itemid}{'mapcrstype'}) eq 'ARRAY') {
               if (grep(/^$crstype$/,@{$lti{$itemid}{'mapcrstype'}})) {
                   &Apache::lonnet::put_dom('lticonsumers',{ $sourcecrs => $itemid.':'.$cnum },$cdom);
               }
           }
     }      }
   
 #  #

Removed from v.1.26  
changed lines
  Added in v.1.28


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>