Diff for /loncom/cgi/lonauthcgi.pm between versions 1.1 and 1.5

version 1.1, 2008/12/25 01:51:03 version 1.5, 2009/10/08 22:37:39
Line 110  sub check_ipbased_access { Line 110  sub check_ipbased_access {
                 }                  }
             }              }
         }          }
         }  
     }      }
     return $allowed;      return $allowed;
 }  }
Line 134  Returns: 1 if access to the page is perm Line 133  Returns: 1 if access to the page is perm
              the requestor as one of the named users (username:domain) with access               the requestor as one of the named users (username:domain) with access
              to the page.               to the page.
   
          In the case of requests for the 'ping' page, and access is also allowed if           In the case of requests for the 'ping' page, access is also allowed if
          at least one domain hosted on requestor's server is also hosted on this server.           at least one domain hosted on requestor's server is also hosted on this server.
   
            In the case of requests for the 'showenv' page (/adm/test), the domains tested
            are not the domains hosted on the server, but instead are a single domain - 
            the domain of the requestor.  In addition, if the requestor has an active 
            Domain Coordinator role for that domain, access is permitted, regardless of  
            the requestor's current role.
 =cut  =cut
   
 #############################################  #############################################
Line 157  sub can_view { Line 161  sub can_view {
             }              }
         }          }
     } else {      } else {
         my @poss_domains = &Apache::lonnet::current_machine_domains();          my @poss_domains;
         foreach my $dom (@poss_domains) {          if ($page eq 'showenv') {
             my %domconfig = &Apache::lonnet::get_dom('configuration',['serverstatuses'],$dom);              @poss_domains = ($env{'user.domain'});
             if ($Apache::lonnet::env{'request.role'} eq "dc./$dom/") {              my $envkey = 'user.role.dc./'.$poss_domains[0].'/';
                 $allowed = 1;              if (exists($Apache::lonnet::env{$envkey})) {
             } elsif (ref($domconfig{'serverstatuses'}) eq 'HASH') {                  my $livedc = 1;
                 if (ref($domconfig{'serverstatuses'}{$page}) eq 'HASH') {                  my $then = $Apache::lonnet::env{'user.login.time'};
                     if ($domconfig{'serverstatuses'}{$page}{'namedusers'} ne '') {                  my ($tstart,$tend)=split(/\./,$Apache::lonnet::env{$envkey});
                         my @okusers = split(/,/,$domconfig{'serverstatuses'}{$page}{'namedusers'});                  if ($tstart && $tstart>$then) { $livedc = 0; }
                         if (grep(/^\Q$Apache::lonnet::env{'user.name'}:$Apache::lonnet::env{'user.domain'}\E$/,@okusers)) {                  if ($tend   && $tend  <$then) { $livedc = 0; }
                             $allowed = 1;                  if ($livedc) {
                       $allowed = 1;
                   }
               }
           } else {
               @poss_domains = &Apache::lonnet::current_machine_domains();
           }
           unless ($allowed) {
               foreach my $dom (@poss_domains) {
                   my %domconfig = &Apache::lonnet::get_dom('configuration',['serverstatuses'],
                                                            $dom);
                   if ($Apache::lonnet::env{'request.role'} eq "dc./$dom/") {
                       $allowed = 1;
                   } elsif (ref($domconfig{'serverstatuses'}) eq 'HASH') {
                       if (ref($domconfig{'serverstatuses'}{$page}) eq 'HASH') {
                           if ($domconfig{'serverstatuses'}{$page}{'namedusers'} ne '') {
                               my @okusers = split(/,/,$domconfig{'serverstatuses'}{$page}{'namedusers'});
                               if (grep(/^\Q$Apache::lonnet::env{'user.name'}:$Apache::lonnet::env{'user.domain'}\E$/,@okusers)) {
                                   $allowed = 1;
                               }
                         }                          }
                     }                      }
                 }                  }
                   last if $allowed;
             }              }
             last if $allowed;  
         }          }
     }      }
     return $allowed;      return $allowed;
Line 248  sub serverstatus_titles { Line 271  sub serverstatus_titles {
                    'takeoffline'       => 'Offline - replace Log-in page',                     'takeoffline'       => 'Offline - replace Log-in page',
                    'takeonline'        => 'Online - restore Log-in page',                     'takeonline'        => 'Online - restore Log-in page',
                    'showenv'           => "Show user environment",                     'showenv'           => "Show user environment",
                      'toggledebug'       => "Toggle debug messages",
                  );                   );
     return \%titles;      return \%titles;
 }  }

Removed from v.1.1  
changed lines
  Added in v.1.5


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