version 1.101, 2005/04/07 06:56:23
|
version 1.104, 2005/06/17 21:04:40
|
Line 108 sub my_custom_roles {
|
Line 108 sub my_custom_roles {
|
|
|
sub authorpriv { |
sub authorpriv { |
my ($auname,$audom)=@_; |
my ($auname,$audom)=@_; |
if (($auname ne $env{'user.name'}) || |
unless (&Apache::lonnet::allowed('cca',$audom.'/'.$auname)) { return ''; } |
(($audom ne $env{'user.domain'}) && |
|
($audom ne $env{'request.role.domain'}))) { return ''; } |
|
unless (&Apache::lonnet::allowed('cca',$audom)) { return ''; } |
|
return 1; |
return 1; |
} |
} |
|
|
Line 544 END
|
Line 541 END
|
$bgcol=~s/[^7-9a-e]//g; |
$bgcol=~s/[^7-9a-e]//g; |
$bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',2,6); |
$bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',2,6); |
if ($area=~/^\/(\w+)\/(\d\w+)\/(\w+)/) { |
if ($area=~/^\/(\w+)\/(\d\w+)\/(\w+)/) { |
$carea.='<br>Section/Group: '.$3; |
$carea.='<br />Section/Group: '.$3; |
$sortkey.="\0$3"; |
$sortkey.="\0$3"; |
} |
} |
$area=$carea; |
$area=$carea; |
Line 990 ENDMODIFYUSERHEAD
|
Line 987 ENDMODIFYUSERHEAD
|
&Apache::lonnet::modifyuserauth( |
&Apache::lonnet::modifyuserauth( |
$env{'form.ccdomain'},$env{'form.ccuname'}, |
$env{'form.ccdomain'},$env{'form.ccuname'}, |
$amode,$genpwd)); |
$amode,$genpwd)); |
$r->print('<br>'.&mt('Home server').': '.&Apache::lonnet::homeserver |
$r->print('<br />'.&mt('Home server').': '.&Apache::lonnet::homeserver |
($env{'form.ccuname'},$env{'form.ccdomain'})); |
($env{'form.ccuname'},$env{'form.ccdomain'})); |
} else { |
} else { |
# Okay, this is a non-fatal error. |
# Okay, this is a non-fatal error. |
Line 1088 END
|
Line 1085 END
|
# Revoke standard role |
# Revoke standard role |
$r->print(&mt('Revoking').' '.$2.' in '.$1.': <b>'. |
$r->print(&mt('Revoking').' '.$2.' in '.$1.': <b>'. |
&Apache::lonnet::revokerole($env{'form.ccdomain'}, |
&Apache::lonnet::revokerole($env{'form.ccdomain'}, |
$env{'form.ccuname'},$1,$2).'</b><br>'); |
$env{'form.ccuname'},$1,$2).'</b><br />'); |
if ($2 eq 'st') { |
if ($2 eq 'st') { |
$1=~/^\/(\w+)\/(\w+)/; |
$1=~/^\/(\w+)\/(\w+)/; |
my $cid=$1.'_'.$2; |
my $cid=$1.'_'.$2; |
Line 1099 END
|
Line 1096 END
|
&Apache::lonnet::escape($env{'form.ccuname'}.':'. |
&Apache::lonnet::escape($env{'form.ccuname'}.':'. |
$env{'form.ccdomain'}).'='. |
$env{'form.ccdomain'}).'='. |
&Apache::lonnet::escape($now.':'), |
&Apache::lonnet::escape($now.':'), |
$env{'course.'.$cid.'.home'}).'</b><br>'); |
$env{'course.'.$cid.'.home'}).'</b><br />'); |
} |
} |
} |
} |
if ($_=~/^form\.rev\:([^\_]+)\_cr\.cr\/(\w+)\/(\w+)\/(\w+)$/) { |
if ($_=~/^form\.rev\:([^\_]+)\_cr\.cr\/(\w+)\/(\w+)\/(\w+)$/) { |
Line 1108 END
|
Line 1105 END
|
' '.$4.' by '.$3.'@'.$2.' in '.$1.': <b>'. |
' '.$4.' by '.$3.'@'.$2.' in '.$1.': <b>'. |
&Apache::lonnet::revokecustomrole($env{'form.ccdomain'}, |
&Apache::lonnet::revokecustomrole($env{'form.ccdomain'}, |
$env{'form.ccuname'},$1,$2,$3,$4). |
$env{'form.ccuname'},$1,$2,$3,$4). |
'</b><br>'); |
'</b><br />'); |
} |
} |
} elsif ($_=~/^form\.del/) { |
} elsif ($_=~/^form\.del/) { |
if ($_=~/^form\.del\:([^\_]+)\_([^\_]+)$/) { |
if ($_=~/^form\.del\:([^\_]+)\_([^\_]+)$/) { |
$r->print(&mt('Deleting').' '.$2.' in '.$1.': '. |
$r->print(&mt('Deleting').' '.$2.' in '.$1.': '. |
&Apache::lonnet::assignrole($env{'form.ccdomain'}, |
&Apache::lonnet::assignrole($env{'form.ccdomain'}, |
$env{'form.ccuname'},$1,$2,$now,0,1).'<br>'); |
$env{'form.ccuname'},$1,$2,$now,0,1).'<br />'); |
if ($2 eq 'st') { |
if ($2 eq 'st') { |
$1=~/^\/(\w+)\/(\w+)/; |
$1=~/^\/(\w+)\/(\w+)/; |
my $cid=$1.'_'.$2; |
my $cid=$1.'_'.$2; |
Line 1125 END
|
Line 1122 END
|
&Apache::lonnet::escape($env{'form.ccuname'}.':'. |
&Apache::lonnet::escape($env{'form.ccuname'}.':'. |
$env{'form.ccdomain'}).'='. |
$env{'form.ccdomain'}).'='. |
&Apache::lonnet::escape($now.':'), |
&Apache::lonnet::escape($now.':'), |
$env{'course.'.$cid.'.home'}).'</b><br>'); |
$env{'course.'.$cid.'.home'}).'</b><br />'); |
} |
} |
} |
} |
} elsif ($_=~/^form\.ren/) { |
} elsif ($_=~/^form\.ren/) { |
Line 1245 END
|
Line 1242 END
|
} |
} |
} |
} |
} else { |
} else { |
$r->print('<p>'.&mt('ERROR').': '.&mt('Unknown command').' <tt>'.$_.'</tt></p><br>'); |
$r->print('<p>'.&mt('ERROR').': '.&mt('Unknown command').' <tt>'.$_.'</tt></p><br />'); |
} |
} |
} |
} |
} # End of foreach (keys(%env)) |
} # End of foreach (keys(%env)) |
# Flush the course logs so reverse user roles immediately updated |
# Flush the course logs so reverse user roles immediately updated |
&Apache::lonnet::flushcourselogs(); |
&Apache::lonnet::flushcourselogs(); |
|
$r->print('<p><a href="/adm/createuser">Create/Modify Another User</a></p>'); |
$r->print('</body></html>'); |
$r->print('</body></html>'); |
} |
} |
|
|
Line 1261 sub commit_customrole {
|
Line 1259 sub commit_customrole {
|
($end?', ending '.localtime($end):'').': <b>'. |
($end?', ending '.localtime($end):'').': <b>'. |
&Apache::lonnet::assigncustomrole( |
&Apache::lonnet::assigncustomrole( |
$udom,$uname,$url,$three,$four,$five,$end,$start). |
$udom,$uname,$url,$three,$four,$five,$end,$start). |
'</b><br>'; |
'</b><br />'; |
return $output; |
return $output; |
} |
} |
|
|
Line 1286 sub commit_standardrole {
|
Line 1284 sub commit_standardrole {
|
($end?', '.&mt('ending').' '.localtime($end):'').': <b>'. |
($end?', '.&mt('ending').' '.localtime($end):'').': <b>'. |
&Apache::lonnet::assignrole( |
&Apache::lonnet::assignrole( |
$udom,$uname,$url,$three,$end,$start). |
$udom,$uname,$url,$three,$end,$start). |
'</b><br>'; |
'</b><br />'; |
} |
} |
return $output; |
return $output; |
} |
} |
Line 1552 sub handler {
|
Line 1550 sub handler {
|
(&Apache::lonnet::allowed('cin',$env{'request.course.id'})) || |
(&Apache::lonnet::allowed('cin',$env{'request.course.id'})) || |
(&Apache::lonnet::allowed('ccr',$env{'request.course.id'})) || |
(&Apache::lonnet::allowed('ccr',$env{'request.course.id'})) || |
(&Apache::lonnet::allowed('cep',$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::lonnet::allowed('mau',$env{'request.role.domain'}))) { |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |