--- loncom/auth/lonroles.pm 2008/03/22 03:52:04 1.181.2.2 +++ loncom/auth/lonroles.pm 2008/03/04 22:44:21 1.184 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # User Roles Screen # -# $Id: lonroles.pm,v 1.181.2.2 2008/03/22 03:52:04 raeburn Exp $ +# $Id: lonroles.pm,v 1.184 2008/03/04 22:44:21 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -122,13 +122,37 @@ sub handler { "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 +# Check if user is a DC trying to enter a course or author space and needs privs to be created if ($numdc > 0) { foreach my $envkey (keys %env) { +# Is this an ad-hoc CC-role? if (my ($domain,$coursenum) = ($envkey =~ m-^form\.cc\./($match_domain)/($match_courseid)$-)) { if ($dcroles{$domain}) { - &check_privs($domain,$coursenum,$then,$now); + &check_privs($domain,$coursenum,$then,$now,'cc'); + } + last; + } +# Is this a recent ad-hoc CA-role? + if (my ($domain,$user) = + ($envkey =~ m-^form\.ca\./($match_domain)/($match_username)$-)) { + if (($dcroles{$domain}) && (&is_author_homeserver($user,$domain))) { + &check_privs($domain,$user,$then,$now,'ca'); + } else { + delete($env{$envkey}); + } + last; + } +# Is this a new ad-hoc CA-role? + if (my ($domain) = + ($envkey =~ m-^form\.adhocca\./($match_domain)$-)) { + if ($dcroles{$domain}) { + my $user=$env{'form.adhoccauname.'.$domain}; + if (!$user) { $user=$env{'form.adhoccaunamerecent.'.$domain} }; + if (($user) && ($user=~/$match_username/) && (&is_author_homeserver($user,$domain))) { + &check_privs($domain,$user,$then,$now,'ca'); + $env{'form.ca./'.$domain.'/'.$user}=1; + } } last; } @@ -410,16 +434,16 @@ ENDHEADER # -------------------------------------------------------- Generate Page Output # --------------------------------------------------------------- Error Header? if ($error) { - $r->print("
"); if ($priv ne '') { - $r->print(&mt('Access : ').&Apache::lonnet::plaintext($priv)."\n"); + $r->print("Access : ".&Apache::lonnet::plaintext($priv)."\n"); } if ($fn ne '') { - $r->print(&mt('Resource: ').&Apache::lonenc::check_encrypt($fn)."\n"); + $r->print("Resource: ".&Apache::lonenc::check_encrypt($fn)."\n"); } if ($msg ne '') { - $r->print(&mt('Action : ').$msg."\n"); + $r->print("Action : $msg\n"); } $r->print("