--- loncom/auth/lonroles.pm 2004/11/09 16:18:51 1.103 +++ loncom/auth/lonroles.pm 2005/03/03 07:16:44 1.116 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # User Roles Screen # -# $Id: lonroles.pm,v 1.103 2004/11/09 16:18:51 raeburn Exp $ +# $Id: lonroles.pm,v 1.116 2005/03/03 07:16:44 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,6 +36,7 @@ use Apache::Constants qw(:common); use Apache::File(); use Apache::lonmenu; use Apache::loncommon; +use Apache::lonhtmlcommon; use Apache::lonannounce; use Apache::lonlocal; @@ -81,7 +82,8 @@ sub handler { my $now=time; my $then=$ENV{'user.login.time'}; my $envkey; - + my %dcroles = (); + my $numdc = &check_fordc(\%dcroles,$then); # ================================================================== Roles Init if ($ENV{'form.selectrole'}) { @@ -97,6 +99,20 @@ sub handler { "request.role" => 'cm', "request.role.adv" => $ENV{'user.adv'}, "request.role.domain" => $ENV{'user.domain'}); + +# Check if user is a DC trying to enter a course and needs privs to be created + if ($numdc > 0) { + foreach my $envkey (keys %ENV) { + if ($envkey =~ m-^form\.cc\./(\w+)/(\w+)$-) { + if ($dcroles{$1}) { + my $cckey = 'user.role.cc./'.$1.'/'.$2; + &check_privs($cckey,$then,$now); + } + last; + } + } + } + foreach $envkey (keys %ENV) { next if ($envkey!~/^user\.role\./); my ($where,$trolecode,$role,$tstatus,$tend,$tstart); @@ -105,6 +121,13 @@ sub handler { if ($tstatus eq 'is') { $where=~s/^\///; my ($cdom,$cnum,$csec)=split(/\//,$where); +# store role if recent_role list being kept + if ($ENV{'environment.recentroles'}) { + &Apache::lonhtmlcommon::store_recent('roles', + $trolecode,' '); + } + + # check for keyed access if (($role eq 'st') && ($ENV{'course.'.$cdom.'_'.$cnum.'.keyaccess'} eq 'yes')) { @@ -239,7 +262,6 @@ ENDENTERKEY '.course.helper.not.run'}) { $furl = "/adm/helper/course.initialization.helper"; } - # # Send the user to the course they selected &redirect_user($r,&mt('Entering Course'), $furl,$msg, @@ -262,6 +284,12 @@ ENDENTERKEY $redirect_url); return OK; } + if ($role eq 'dc') { + my $redirect_url = '/adm/menu/'; + &redirect_user($r,&mt('Loading Domain Coordinator Menu'), + $redirect_url); + return OK; + } } } } @@ -311,7 +339,7 @@ ENDHEADER $r->print("
Access : ". Apache::lonnet::plaintext($priv)."\n"); - $r->print("Resource: $fn\n"); + $r->print("Resource: ".&Apache::lonenc::check_encrypt($fn)."\n"); $r->print("Action : $msg\n