--- loncom/auth/lonroles.pm 2000/09/06 14:25:17 1.5 +++ loncom/auth/lonroles.pm 2000/09/29 14:36:30 1.6 @@ -4,7 +4,7 @@ # (Login Screen # 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14 Gerd Kortemeyer) # 11/23 Gerd Kortemeyer) -# 1/14,03/06,06/01,07/22,07/24,07/25,09/04,09/06 Gerd Kortemeyer +# 1/14,03/06,06/01,07/22,07/24,07/25,09/04,09/06,09/28,09/29 Gerd Kortemeyer # package Apache::lonroles; @@ -28,14 +28,68 @@ sub handler {
ENDHEADER + my $now=time; + my $then=$ENV{'user.login.time'}; + my $envkey; + +# ================================================================== Roles Init + + if ($ENV{'form.selectrole'}) { + foreach $envkey (keys %ENV) { + if ($envkey=~/^user\.role\./) { + my ($dum1,$dum2,$role,@pwhere)=split(/\./,$envkey); + my $where=join('.',@pwhere); + my $trolecode=$role.'.'.$where; + if ($ENV{'form.'.$trolecode}) { + my ($tstart,$tend)=split(/\./,$ENV{$envkey}); + my $tstatus='is'; + if ($tstart) { + if ($tstart>$then) { + $tstatus='future'; + } + } + if ($tend) { + if ($tend<$then) { $tstatus='expired'; } + if ($tend>$now) { $tstatus='will_not'; } + } + if ($tstatus eq 'is') { + &Apache::lonnet::appenv('request.role' => $trolecode); + + if ($where=~/\.course$/) { +# $r->print( +# &Apache::lonuserstate::readmap('/res/msu/korte/foo.course','phy231',$fn). + } + + $r->print("Yeah!"); + + } + } + } + } + + $r->print('