Diff for /loncom/lonnet/perl/lonnet.pm between versions 1.1462 and 1.1465

version 1.1462, 2021/08/01 19:28:11 version 1.1465, 2021/09/21 22:54:27
Line 7133  sub dump { Line 7133  sub dump {
     my $rep;      my $rep;
     if ($encrypt) {      if ($encrypt) {
         $rep=&reply("encrypt:edump:$udomain:$uname:$namespace:$regexp:$range",$uhome);          $rep=&reply("encrypt:edump:$udomain:$uname:$namespace:$regexp:$range",$uhome);
     } else {       } else {
         $rep=&reply("dump:$udomain:$uname:$namespace:$regexp:$range",$uhome);          $rep=&reply("dump:$udomain:$uname:$namespace:$regexp:$range",$uhome);
     }      }
     my @pairs=split(/\&/,$rep);      my @pairs=split(/\&/,$rep);
Line 9065  sub deeplink_check { Line 9065  sub deeplink_check {
         if ($deeplink eq '') {          if ($deeplink eq '') {
             $allow = 1;              $allow = 1;
         } else {          } else {
             my ($listed,$scope,$access) = split(/,/,$deeplink);              my ($state,$others,$listed,$scope,$protect) = split(/,/,$deeplink);
             if ($access eq 'any') {              if ($state ne 'only') {
                 $allow = 1;                  $allow = 1;
             } elsif ($deeplink_symb) {              } else {
                 if ($access eq 'only') {                  my $check_deeplink_entry;
                   if ($protect ne 'none') {
                       my ($acctype,$item) = split(/:/,$protect);
                       if (($acctype eq 'ltic') && ($env{'user.linkprotector'})) {
                           if (grep(/^\Q$item\Ec$/,split(/,/,$env{'user.linkprotector'}))) {
                               $check_deeplink_entry = 1
                           }
                       } elsif (($acctype eq 'ltid') && ($env{'user.linkprotector'})) {
                           if (grep(/^\Q$item\Ed$/,split(/,/,$env{'user.linkprotector'}))) {
                               $check_deeplink_entry = 1;
                           }
                       } elsif (($acctype eq 'key') && ($env{'user.deeplinkkey'})) {
                           if (grep(/^\Q$item\E$/,split(/,/,$env{'user.deeplinkkey'}))) {
                               $check_deeplink_entry = 1;
                           }
                       }
                   }
                   if (($protect eq 'none') || ($check_deeplink_entry)) {
                     if ($scope eq 'res') {                      if ($scope eq 'res') {
                         if ($symb eq $deeplink_symb) {                          if ($symb eq $deeplink_symb) {
                             $allow = 1;                              $allow = 1;
                         }                          }
                     } elsif (($scope eq 'map') || ($scope eq 'rec')) {                      } elsif (($scope eq 'map') || ($scope eq 'rec')) {
                         my ($map_from_symb,$map_from_login);                           my ($map_from_symb,$map_from_login);
                         $map_from_symb = &deversion((&decode_symb($symb))[0]);                          $map_from_symb = &deversion((&decode_symb($symb))[0]);
                         if ($deeplink_symb =~ /\.(page|sequence)$/) {                          if ($deeplink_symb =~ /\.(page|sequence)$/) {
                             $map_from_login = &deversion((&decode_symb($deeplink_symb))[2]);                              $map_from_login = &deversion((&decode_symb($deeplink_symb))[2]);
Line 9093  sub deeplink_check { Line 9110  sub deeplink_check {
                             }                              }
                         }                          }
                     }                      }
                 } else {  
                     my ($acctype,$item) = split(/:/,$access);  
                     if (($acctype eq 'lti') && ($env{'user.linkprotector'})) {  
                         if (grep(/^\Q$item\E$/,split(/,/,$env{'user.linkprotector'}))) {  
                             my %tinyurls = &get('tiny',[$symb],$cdom,$cnum);  
                             if (grep(/\Q$tinyurls{$symb}\E$/,split(/,/,$env{'user.linkproturis'}))) {  
                                 $allow = 1;  
                             }  
                         }  
                     } elsif (($acctype eq 'key') && ($env{'user.deeplinkkey'})) {  
                         if (grep(/^\Q$item\E$/,split(/,/,$env{'user.deeplinkkey'}))) {  
                             my %tinyurls = &get('tiny',[$symb],$cdom,$cnum);  
                             if (grep(/\Q$tinyurls{$symb}\E$/,split(/,/,$env{'user.keyedlinkuri'}))) {  
                                 $allow = 1;  
                             }  
                         }  
                     }  
                 }                  }
             }              }
         }          }
Line 12215  sub get_domain_lti { Line 12215  sub get_domain_lti {
     return %lti;      return %lti;
 }  }
   
   sub get_course_lti {
       my ($cnum,$cdom) = @_;
       my $hashid=$cdom.'_'.$cnum;
       my %courselti;
       my ($result,$cached)=&is_cached_new('courselti',$hashid);
       if (defined($cached)) {
           if (ref($result) eq 'HASH') {
               %courselti = %{$result};
           }
       } else {
           %courselti = &dump('lti',$cdom,$cnum,undef,undef,undef,1);
           my $cachetime = 24*60*60;
           &do_cache_new('courselti',$hashid,\%courselti,$cachetime);
       }
       return %courselti;
   }
   
 sub get_numsuppfiles {  sub get_numsuppfiles {
     my ($cnum,$cdom,$ignorecache)=@_;      my ($cnum,$cdom,$ignorecache)=@_;
     my $hashid=$cnum.':'.$cdom;      my $hashid=$cnum.':'.$cdom;
Line 14569  sub get_proxy_alias { Line 14586  sub get_proxy_alias {
             my $cachetime = 60*60*24;              my $cachetime = 60*60*24;
             my %domconfig =              my %domconfig =
                 &Apache::lonnet::get_dom('configuration',['wafproxy'],$dom);                  &Apache::lonnet::get_dom('configuration',['wafproxy'],$dom);
             my $alias;  
             if (ref($domconfig{'wafproxy'}) eq 'HASH') {              if (ref($domconfig{'wafproxy'}) eq 'HASH') {
                 if (ref($domconfig{'wafproxy'}{'alias'}) eq 'HASH') {                  if (ref($domconfig{'wafproxy'}{'alias'}) eq 'HASH') {
                     $alias = $domconfig{'wafproxy'}{'alias'}{$lonid};                      $alias = $domconfig{'wafproxy'}{'alias'}{$lonid};
Line 14602  sub use_proxy_alias { Line 14618  sub use_proxy_alias {
     }      }
     return;      return;
 }  }
   
   sub get_saml_landing {
       my ($lonid) = @_;
       if ($lonid eq '') {
           my $defdom = &default_login_domain();
           my @hosts = &current_machine_ids();
           if (@hosts > 1) {
               foreach my $hostid (@hosts) {
                   if (&host_domain($hostid) eq $defdom) {
                       $lonid = $hostid;
                       last;
                   }
               }
           } else {
               $lonid = $perlvar{'lonHostID'};
           }
           if ($lonid) {
               unless (&Apache::lonnet::host_domain($lonid) eq $defdom) {
                   return;
               }
           } else {
               return;
           }
       } elsif (!defined(&hostname($lonid))) {
           return;
       }
       my ($landing,$cached) = &is_cached_new('samllanding',$lonid);
       if ($cached) {
           return $landing;
       }
       my $dom = &Apache::lonnet::host_domain($lonid);
       if ($dom ne '') {
           my $cachetime = 60*60*24;
           my %domconfig =
               &Apache::lonnet::get_dom('configuration',['login'],$dom);
           if (ref($domconfig{'login'}) eq 'HASH') {
               if (ref($domconfig{'login'}{'saml'}) eq 'HASH') {
                   if (ref($domconfig{'login'}{'saml'}{$lonid}) eq 'HASH') {
                       $landing = 1;
                   }
               }
           }
           return &do_cache_new('samllanding',$lonid,$landing,$cachetime);
       }
       return;
   }
   
 # ------------------------------------------------------------- Declutters URLs  # ------------------------------------------------------------- Declutters URLs
   

Removed from v.1.1462  
changed lines
  Added in v.1.1465


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