Diff for /loncom/auth/loncacc.pm between versions 1.49 and 1.52

version 1.49, 2009/04/11 21:42:58 version 1.52, 2011/02/24 23:42:18
Line 119  sub constructaccess { Line 119  sub constructaccess {
     }      }
   
     my $then=$env{'user.login.time'};      my $then=$env{'user.login.time'};
       my $update==$env{'user.updateroles.time'};
       if (!$update) {
           $update = $then;
       }
     my %dcroles = ();      my %dcroles = ();
     if (&is_active_dc($ownerdomain,$then)) {      if (&is_active_dc($ownerdomain,$update)) {
         my %blocked=&Apache::lonnet::get('environment',['domcoord.author'],          my %blocked=&Apache::lonnet::get('environment',['domcoord.author'],
                                          $ownerdomain,$ownername);                                           $ownerdomain,$ownername);
         unless ($blocked{'domcoord.author'} eq 'blocked') {          unless ($blocked{'domcoord.author'} eq 'blocked') {
             if (grep(/^$ownerdomain$/,@possibledomains)) {              if (grep(/^$ownerdomain$/,@possibledomains)) {
                 if ($setpriv) {                  if ($setpriv) {
                       my $refresh=$env{'user.refresh.time'};
                       if (!$refresh) {
                           $refresh = $update;
                       }
                     my $now = time;                      my $now = time;
                     &Apache::lonnet::check_adhoc_privs($ownerdomain,$ownername,                      &Apache::lonnet::check_adhoc_privs($ownerdomain,$ownername,
                                                        $then,$now,'ca');                                                         $update,$refresh,$now,'ca',
                                                          'constructaccess');
                 }                  }
                 return($ownername,$ownerdomain);                  return($ownername,$ownerdomain);
             }              }
Line 138  sub constructaccess { Line 147  sub constructaccess {
 }  }
   
 sub is_active_dc {  sub is_active_dc {
     my ($ownerdomain,$then) = @_;      my ($ownerdomain,$update) = @_;
     my $livedc;      my $livedc;
     if ($env{'user.adv'}) {      if ($env{'user.adv'}) {
         my $domrole = $env{'user.role.dc./'.$ownerdomain.'/'};          my $domrole = $env{'user.role.dc./'.$ownerdomain.'/'};
         if ($domrole) {          if ($domrole) {
             my ($tstart,$tend)=split(/\./,$domrole);              my ($tstart,$tend)=split(/\./,$domrole);
             $livedc = 1;              $livedc = 1;
             if ($tstart && $tstart>$then) { undef($livedc); }              if ($tstart && $tstart>$update) { undef($livedc); }
             if ($tend   && $tend  <$then) { undef($livedc); }              if ($tend   && $tend  <$update) { undef($livedc); }
         }          }
     }      }
     return $livedc;      return $livedc;
Line 174  sub handler { Line 183  sub handler {
  $env{'request.state'}    = "construct";   $env{'request.state'}    = "construct";
  $env{'request.filename'} = $r->filename;   $env{'request.filename'} = $r->filename;
   
  unless (&constructaccess($requrl,$r->dir_config('lonDefDomain')),'setpriv') {   unless (&constructaccess($requrl,$r->dir_config('lonDefDomain'),'setpriv')) {
     $r->log_reason("Unauthorized $requrl", $r->filename);       $r->log_reason("Unauthorized $requrl", $r->filename); 
     return HTTP_NOT_ACCEPTABLE;      return HTTP_NOT_ACCEPTABLE;
  }   }

Removed from v.1.49  
changed lines
  Added in v.1.52


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