--- loncom/interface/loncreateuser.pm 2005/04/07 06:56:23 1.101 +++ loncom/interface/loncreateuser.pm 2005/06/17 21:04:40 1.104 @@ -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.104 2005/06/17 21:04:40 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -108,10 +108,7 @@ 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)) { return ''; } return 1; } @@ -544,7 +541,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; @@ -990,7 +987,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 +1085,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 +1096,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 +1105,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 +1122,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 +1242,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 +1259,7 @@ sub commit_customrole { ($end?', ending '.localtime($end):'').': '. &Apache::lonnet::assigncustomrole( $udom,$uname,$url,$three,$four,$five,$end,$start). - '
'; + '
'; return $output; } @@ -1286,7 +1284,7 @@ sub commit_standardrole { ($end?', '.&mt('ending').' '.localtime($end):'').': '. &Apache::lonnet::assignrole( $udom,$uname,$url,$three,$end,$start). - '
'; + '
'; } return $output; } @@ -1552,7 +1550,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;