--- loncom/interface/loncreateuser.pm 2005/04/07 06:56:23 1.101 +++ loncom/interface/loncreateuser.pm 2005/06/23 21:59:13 1.107 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.101 2005/04/07 06:56:23 albertel Exp $ +# $Id: loncreateuser.pm,v 1.107 2005/06/23 21:59:13 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -108,10 +108,8 @@ sub my_custom_roles { sub authorpriv { my ($auname,$audom)=@_; - if (($auname ne $env{'user.name'}) || - (($audom ne $env{'user.domain'}) && - ($audom ne $env{'request.role.domain'}))) { return ''; } - unless (&Apache::lonnet::allowed('cca',$audom)) { return ''; } + unless ((&Apache::lonnet::allowed('cca',$audom.'/'.$auname)) + || (&Apache::lonnet::allowed('caa',$audom.'/'.$auname))) { return ''; } return 1; } @@ -158,14 +156,18 @@ $lt{'dom'}:$domform +ENDDOCUMENT + if (&Apache::lonnet::allowed('mcr','/')) { + $r->print(<

$lt{'ecrp'}$helpecpr

$lt{'nr'}: $choice
- - -ENDDOCUMENT + +ENDCUSTOM + } + $r->print(''); } # =================================================================== Phase two @@ -544,7 +546,7 @@ END $bgcol=~s/[^7-9a-e]//g; $bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',2,6); if ($area=~/^\/(\w+)\/(\d\w+)\/(\w+)/) { - $carea.='
Section/Group: '.$3; + $carea.='
Section/Group: '.$3; $sortkey.="\0$3"; } $area=$carea; @@ -574,7 +576,7 @@ END $class='Domain'; } } - if ($role_code eq 'ca') { + if (($role_code eq 'ca') || ($role_code eq 'aa')) { $area=~/\/(\w+)\/(\w+)/; if (&authorpriv($2,$1)) { $allowed=1; @@ -778,6 +780,7 @@ ENDOTHERAUTHS 'sta' => "Start", 'end' => "End", 'cau' => "Co-Author", + 'caa' => "Assistant Co-Author", 'ssd' => "Set Start Date", 'sed' => "Set End Date" ); @@ -796,6 +799,17 @@ ENDOTHERAUTHS $lt{'sed'} + + +$lt{'caa'} +$cudom\_$cuname + +$lt{'ssd'} + +$lt{'sed'} + ENDCOAUTH } @@ -990,7 +1004,7 @@ ENDMODIFYUSERHEAD &Apache::lonnet::modifyuserauth( $env{'form.ccdomain'},$env{'form.ccuname'}, $amode,$genpwd)); - $r->print('
'.&mt('Home server').': '.&Apache::lonnet::homeserver + $r->print('
'.&mt('Home server').': '.&Apache::lonnet::homeserver ($env{'form.ccuname'},$env{'form.ccdomain'})); } else { # Okay, this is a non-fatal error. @@ -1088,7 +1102,7 @@ END # Revoke standard role $r->print(&mt('Revoking').' '.$2.' in '.$1.': '. &Apache::lonnet::revokerole($env{'form.ccdomain'}, - $env{'form.ccuname'},$1,$2).'
'); + $env{'form.ccuname'},$1,$2).'
'); if ($2 eq 'st') { $1=~/^\/(\w+)\/(\w+)/; my $cid=$1.'_'.$2; @@ -1099,7 +1113,7 @@ END &Apache::lonnet::escape($env{'form.ccuname'}.':'. $env{'form.ccdomain'}).'='. &Apache::lonnet::escape($now.':'), - $env{'course.'.$cid.'.home'}).'
'); + $env{'course.'.$cid.'.home'}).'
'); } } if ($_=~/^form\.rev\:([^\_]+)\_cr\.cr\/(\w+)\/(\w+)\/(\w+)$/) { @@ -1108,13 +1122,13 @@ END ' '.$4.' by '.$3.'@'.$2.' in '.$1.': '. &Apache::lonnet::revokecustomrole($env{'form.ccdomain'}, $env{'form.ccuname'},$1,$2,$3,$4). - '
'); + '
'); } } elsif ($_=~/^form\.del/) { if ($_=~/^form\.del\:([^\_]+)\_([^\_]+)$/) { $r->print(&mt('Deleting').' '.$2.' in '.$1.': '. &Apache::lonnet::assignrole($env{'form.ccdomain'}, - $env{'form.ccuname'},$1,$2,$now,0,1).'
'); + $env{'form.ccuname'},$1,$2,$now,0,1).'
'); if ($2 eq 'st') { $1=~/^\/(\w+)\/(\w+)/; my $cid=$1.'_'.$2; @@ -1125,7 +1139,7 @@ END &Apache::lonnet::escape($env{'form.ccuname'}.':'. $env{'form.ccdomain'}).'='. &Apache::lonnet::escape($now.':'), - $env{'course.'.$cid.'.home'}).'
'); + $env{'course.'.$cid.'.home'}).'
'); } } } elsif ($_=~/^form\.ren/) { @@ -1245,12 +1259,13 @@ END } } } else { - $r->print('

'.&mt('ERROR').': '.&mt('Unknown command').' '.$_.'


'); + $r->print('

'.&mt('ERROR').': '.&mt('Unknown command').' '.$_.'


'); } } } # End of foreach (keys(%env)) # Flush the course logs so reverse user roles immediately updated &Apache::lonnet::flushcourselogs(); + $r->print('

Create/Modify Another User

'); $r->print(''); } @@ -1261,7 +1276,7 @@ sub commit_customrole { ($end?', ending '.localtime($end):'').': '. &Apache::lonnet::assigncustomrole( $udom,$uname,$url,$three,$four,$five,$end,$start). - '
'; + '
'; return $output; } @@ -1286,7 +1301,7 @@ sub commit_standardrole { ($end?', '.&mt('ending').' '.localtime($end):'').': '. &Apache::lonnet::assignrole( $udom,$uname,$url,$three,$end,$start). - '
'; + '
'; } return $output; } @@ -1552,7 +1567,7 @@ sub handler { (&Apache::lonnet::allowed('cin',$env{'request.course.id'})) || (&Apache::lonnet::allowed('ccr',$env{'request.course.id'})) || (&Apache::lonnet::allowed('cep',$env{'request.course.id'})) || - (&Apache::lonnet::allowed('cca',$env{'request.role.domain'})) || + (&authorpriv($env{'user.name'},$env{'request.role.domain'})) || (&Apache::lonnet::allowed('mau',$env{'request.role.domain'}))) { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header;