version 1.44, 2002/11/18 20:06:53
|
version 1.60, 2003/07/18 13:45:14
|
Line 44
|
Line 44
|
# 2/14,2/17,2/19,2/20,2/21,2/22,2/23,3/2,3/17,3/24,04/12 Gerd Kortemeyer |
# 2/14,2/17,2/19,2/20,2/21,2/22,2/23,3/2,3/17,3/24,04/12 Gerd Kortemeyer |
# April Guy Albertelli |
# April Guy Albertelli |
# 05/10,10/16 Gerd Kortemeyer |
# 05/10,10/16 Gerd Kortemeyer |
# 11/12,11/13,11/15 Scott Harrison |
|
# 02/11/02 Matthew Hall |
# 02/11/02 Matthew Hall |
# |
# |
# $Id$ |
# $Id$ |
Line 55 package Apache::loncreateuser;
|
Line 54 package Apache::loncreateuser;
|
use strict; |
use strict; |
use Apache::Constants qw(:common :http); |
use Apache::Constants qw(:common :http); |
use Apache::lonnet; |
use Apache::lonnet; |
|
use Apache::loncommon; |
|
|
my $loginscript; # piece of javascript used in two separate instances |
my $loginscript; # piece of javascript used in two separate instances |
my $generalrule; |
my $generalrule; |
Line 71 BEGIN {
|
Line 71 BEGIN {
|
my %param = ( formname => 'document.cu', |
my %param = ( formname => 'document.cu', |
kerb_def_dom => $krbdefdom |
kerb_def_dom => $krbdefdom |
); |
); |
$loginscript = &Apache::loncommon::authform_header(%param); |
# no longer static due to configurable kerberos defaults |
|
# $loginscript = &Apache::loncommon::authform_header(%param); |
$generalrule = &Apache::loncommon::authform_authorwarning(%param); |
$generalrule = &Apache::loncommon::authform_authorwarning(%param); |
$authformnop = &Apache::loncommon::authform_nochange(%param); |
$authformnop = &Apache::loncommon::authform_nochange(%param); |
$authformkrb = &Apache::loncommon::authform_kerberos(%param); |
# no longer static due to configurable kerberos defaults |
|
# $authformkrb = &Apache::loncommon::authform_kerberos(%param); |
$authformint = &Apache::loncommon::authform_internal(%param); |
$authformint = &Apache::loncommon::authform_internal(%param); |
$authformfsys = &Apache::loncommon::authform_filesystem(%param); |
$authformfsys = &Apache::loncommon::authform_filesystem(%param); |
$authformloc = &Apache::loncommon::authform_local(%param); |
$authformloc = &Apache::loncommon::authform_local(%param); |
} |
} |
|
|
|
|
|
# ======================================================= Existing Custom Roles |
|
|
|
sub my_custom_roles { |
|
my %returnhash=(); |
|
my %rolehash=&Apache::lonnet::dump('roles'); |
|
foreach (keys %rolehash) { |
|
if ($_=~/^rolesdef\_(\w+)$/) { |
|
$returnhash{$_}=$_; |
|
} |
|
} |
|
return %returnhash; |
|
} |
|
|
# ==================================================== Figure out author access |
# ==================================================== Figure out author access |
|
|
Line 102 sub print_username_entry_form {
|
Line 116 sub print_username_entry_form {
|
my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain'); |
my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain'); |
my $bodytag =&Apache::loncommon::bodytag( |
my $bodytag =&Apache::loncommon::bodytag( |
'Create Users, Change User Privileges'); |
'Create Users, Change User Privileges'); |
|
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
|
my $sellink=&Apache::loncommon::selectstudent_link |
|
('crtuser','ccuname','ccdomain'); |
|
my %existingroles=&my_custom_roles(); |
|
my $choice=&Apache::loncommon::select_form('make new role','rolename', |
|
('make new role' => 'Generate new role ...',%existingroles)); |
$r->print(<<"ENDDOCUMENT"); |
$r->print(<<"ENDDOCUMENT"); |
<html> |
<html> |
<head> |
<head> |
<title>The LearningOnline Network with CAPA</title> |
<title>The LearningOnline Network with CAPA</title> |
|
$selscript |
</head> |
</head> |
$bodytag |
$bodytag |
<form action="/adm/createuser" method="post"> |
<form action="/adm/createuser" method="post" name="crtuser"> |
<input type="hidden" name="phase" value="get_user_info"> |
<input type="hidden" name="phase" value="get_user_info"> |
<p> |
<h2>Set Individual User Roles</h2> |
<table> |
<table> |
<tr><td>Username:</td><td><input type="text" size="15" name="ccuname"> |
<tr><td>Username:</td><td><input type="text" size="15" name="ccuname"> |
</td></tr><tr><td> |
</td><td rowspan="2">$sellink</td></tr><tr><td> |
Domain:</td><td>$domform</td></tr> |
Domain:</td><td>$domform</td></tr> |
</table> |
</table> |
</p> |
<input name="userrole" type="submit" value="User Roles" /> |
<input type="submit" value="Continue"> |
|
</form> |
</form> |
|
<form action="/adm/createuser" method="post" name="docustom"> |
|
<input type="hidden" name="phase" value="selected_custom_edit"> |
|
<h2>Edit Custom Role Privileges</h2> |
|
Name of Role: $choice <input type="text" size="15" name="newrolename" /><br /> |
|
<input name="customeditor" type="submit" value="Custom Role Editor" /> |
</body> |
</body> |
</html> |
</html> |
ENDDOCUMENT |
ENDDOCUMENT |
Line 130 sub print_user_modification_page {
|
Line 155 sub print_user_modification_page {
|
my $ccuname=$ENV{'form.ccuname'}; |
my $ccuname=$ENV{'form.ccuname'}; |
my $ccdomain=$ENV{'form.ccdomain'}; |
my $ccdomain=$ENV{'form.ccdomain'}; |
|
|
$ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/; |
$ccuname=~s/\W//gs; |
my $krbdefdom=$1; |
$ccdomain=~s/\W//gs; |
$krbdefdom=~tr/a-z/A-Z/; |
|
|
unless (($ccuname) && ($ccdomain)) { |
|
&print_username_entry_form($r); |
|
return; |
|
} |
|
|
|
my $defdom=$ENV{'request.role.domain'}; |
|
|
|
my ($krbdef,$krbdefdom) = |
|
&Apache::loncommon::get_kerberos_defaults($defdom); |
|
|
my %param = ( formname => 'document.cu', |
my %param = ( formname => 'document.cu', |
kerb_def_dom => $krbdefdom |
kerb_def_dom => $krbdefdom, |
|
kerb_def_auth => $krbdef |
); |
); |
$loginscript = &Apache::loncommon::authform_header(%param); |
$loginscript = &Apache::loncommon::authform_header(%param); |
|
$authformkrb = &Apache::loncommon::authform_kerberos(%param); |
my $defdom=$ENV{'request.role.domain'}; |
|
|
|
$ccuname=~s/\W//g; |
$ccuname=~s/\W//g; |
$ccdomain=~s/\W//g; |
$ccdomain=~s/\W//g; |
|
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); |
my $dochead =<<"ENDDOCHEAD"; |
my $dochead =<<"ENDDOCHEAD"; |
<html> |
<html> |
<head> |
<head> |
Line 154 sub print_user_modification_page {
|
Line 190 sub print_user_modification_page {
|
parmwin.close(); |
parmwin.close(); |
} |
} |
|
|
function pjump(type,dis,value,marker,ret,call) { |
$pjump_def |
parmwin=window.open("/adm/rat/parameter.html?type="+escape(type) |
|
+"&value="+escape(value)+"&marker="+escape(marker) |
|
+"&return="+escape(ret) |
|
+"&call="+escape(call)+"&name="+escape(dis),"LONCAPAparms", |
|
"height=350,width=350,scrollbars=no,menubar=no"); |
|
|
|
} |
|
|
|
function dateset() { |
function dateset() { |
eval("document.cu."+document.cu.pres_marker.value+ |
eval("document.cu."+document.cu.pres_marker.value+ |
Line 186 ENDFORMINFO
|
Line 215 ENDFORMINFO
|
my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain); |
my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain); |
my %incdomains; |
my %incdomains; |
my %inccourses; |
my %inccourses; |
foreach (%Apache::lonnet::hostdom) { |
foreach (values(%Apache::lonnet::hostdom)) { |
$incdomains{$_}=1; |
$incdomains{$_}=1; |
} |
} |
foreach (keys(%ENV)) { |
foreach (keys(%ENV)) { |
Line 235 ENDNEWUSER
|
Line 264 ENDNEWUSER
|
$dochead |
$dochead |
<h1>Change User Privileges</h1> |
<h1>Change User Privileges</h1> |
$forminfo |
$forminfo |
<h2>User "$ccuname" in domain $ccdomain </h2> |
<h2>User "$ccuname" in domain "$ccdomain"</h2> |
ENDCHANGEUSER |
ENDCHANGEUSER |
# Get the users information |
# Get the users information |
my %userenv = &Apache::lonnet::get('environment', |
my %userenv = &Apache::lonnet::get('environment', |
Line 253 END
|
Line 282 END
|
foreach ('firstname','middlename','lastname','generation') { |
foreach ('firstname','middlename','lastname','generation') { |
if (&Apache::lonnet::allowed('mau',$ccdomain)) { |
if (&Apache::lonnet::allowed('mau',$ccdomain)) { |
$r->print(<<"END"); |
$r->print(<<"END"); |
<td><input type="text" name="c$_" value="$userenv{$_}" size="15"/></td> |
<td><input type="text" name="c$_" value="$userenv{$_}" size="15" /></td> |
END |
END |
} else { |
} else { |
$r->print('<td>'.$userenv{$_}.'</td>'); |
$r->print('<td>'.$userenv{$_}.'</td>'); |
Line 271 END
|
Line 300 END
|
<hr /> |
<hr /> |
<h3>Revoke Existing Roles</h3> |
<h3>Revoke Existing Roles</h3> |
<table border=2> |
<table border=2> |
<tr><th>Revoke</th><th>Role</th><th>Extent</th><th>Start</th><th>End</th> |
<tr><th>Revoke</th><th>Delete</th><th>Role</th><th>Extent</th><th>Start</th><th>End</th> |
END |
END |
foreach my $area (keys(%rolesdump)) { |
foreach my $area (keys(%rolesdump)) { |
next if ($area =~ /^rolesdef/); |
next if ($area =~ /^rolesdef/); |
Line 282 END
|
Line 311 END
|
split(/_/,$role); |
split(/_/,$role); |
my $bgcol='ffffff'; |
my $bgcol='ffffff'; |
my $allowed=0; |
my $allowed=0; |
|
my $delallowed=0; |
if ($area =~ /^\/(\w+)\/(\d\w+)/ ) { |
if ($area =~ /^\/(\w+)\/(\d\w+)/ ) { |
|
my ($coursedom,$coursedir) = ($1,$2); |
|
# $1.'_'.$2 is the course id (eg. 103_12345abcef103l3). |
my %coursedata= |
my %coursedata= |
&Apache::lonnet::coursedescription($1.'_'.$2); |
&Apache::lonnet::coursedescription($1.'_'.$2); |
my $carea='Course: '.$coursedata{'description'}; |
my $carea; |
|
if (defined($coursedata{'description'})) { |
|
$carea='Course: '.$coursedata{'description'}. |
|
'<br />Domain: '.$coursedom.(' 'x8). |
|
&Apache::loncommon::syllabuswrapper('Syllabus',$coursedir,$coursedom); |
|
} else { |
|
$carea='Unavailable course: '.$area; |
|
} |
$inccourses{$1.'_'.$2}=1; |
$inccourses{$1.'_'.$2}=1; |
if (&Apache::lonnet::allowed('c'.$role_code,$1.'/'.$2)) { |
if ((&Apache::lonnet::allowed('c'.$role_code,$1.'/'.$2)) || |
|
(&Apache::lonnet::allowed('c'.$role_code,$ccdomain))) { |
$allowed=1; |
$allowed=1; |
} |
} |
|
if ((&Apache::lonnet::allowed('dro',$1)) || |
|
(&Apache::lonnet::allowed('dro',$ccdomain))) { |
|
$delallowed=1; |
|
} |
# Compute the background color based on $area |
# Compute the background color based on $area |
$bgcol=$1.'_'.$2; |
$bgcol=$1.'_'.$2; |
$bgcol=~s/[^8-9b-e]//g; |
$bgcol=~s/[^8-9b-e]//g; |
Line 301 END
|
Line 345 END
|
} else { |
} else { |
# Determine if current user is able to revoke privileges |
# Determine if current user is able to revoke privileges |
if ($area=~ /^\/(\w+)\//) { |
if ($area=~ /^\/(\w+)\//) { |
if (&Apache::lonnet::allowed('c'.$role_code,$1)) { |
if ((&Apache::lonnet::allowed('c'.$role_code,$1)) || |
|
(&Apache::lonnet::allowed('c'.$role_code,$ccdomain))) { |
$allowed=1; |
$allowed=1; |
} |
} |
|
if (((&Apache::lonnet::allowed('dro',$1)) || |
|
(&Apache::lonnet::allowed('dro',$ccdomain))) && |
|
($role_code ne 'dc')) { |
|
$delallowed=1; |
|
} |
} else { |
} else { |
if (&Apache::lonnet::allowed('c'.$role_code,'/')) { |
if (&Apache::lonnet::allowed('c'.$role_code,'/')) { |
$allowed=1; |
$allowed=1; |
Line 325 END
|
Line 375 END
|
if (($active) && ($allowed)) { |
if (($active) && ($allowed)) { |
$row.= '<input type="checkbox" name="rev:'.$thisrole.'">'; |
$row.= '<input type="checkbox" name="rev:'.$thisrole.'">'; |
} else { |
} else { |
|
if ($active) { |
|
$row.=' '; |
|
} else { |
|
$row.='expired or revoked'; |
|
} |
|
} |
|
$row.='</td><td>'; |
|
if ($delallowed) { |
|
$row.= '<input type="checkbox" name="del:'.$thisrole.'">'; |
|
} else { |
$row.=' '; |
$row.=' '; |
} |
} |
$row.= '</td><td>'.&Apache::lonnet::plaintext($role_code). |
$row.= '</td><td>'.&Apache::lonnet::plaintext($role_code). |
Line 341 END
|
Line 401 END
|
my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain); |
my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain); |
if ($currentauth=~/^krb(4|5):/) { |
if ($currentauth=~/^krb(4|5):/) { |
$currentauth=~/^krb(4|5):(.*)/; |
$currentauth=~/^krb(4|5):(.*)/; |
my $krbdefdom2=$1; |
my $krbdefdom=$1; |
my %param = ( formname => 'document.cu', |
my %param = ( formname => 'document.cu', |
kerb_def_dom => $krbdefdom |
kerb_def_dom => $krbdefdom |
); |
); |
Line 406 ENDBADAUTH
|
Line 466 ENDBADAUTH
|
$authform_other="<p>$authformkrb</p>". |
$authform_other="<p>$authformkrb</p>". |
"<p>$authformint</p><p>$authformfsys</p>"; |
"<p>$authformint</p><p>$authformfsys</p>"; |
} |
} |
$authformcurrent=<<ENDCURRENTAUTH; |
$authformcurrent.=' <i>(will override current values)</i><br />'; |
<table border='1'> |
|
<tr> |
|
<td><font color='#ff0000'>* * * WARNING * * *</font></td> |
|
<td><font color='#ff0000'>* * * WARNING * * *</font></td> |
|
</tr> |
|
<tr><td bgcolor='#cbbcbb'>$authformcurrent</td> |
|
<td bgcolor='#cbbcbb'>Changing this value will overwrite existing authentication for the user; you should notify the user of this change.</td></tr> |
|
</table> |
|
ENDCURRENTAUTH |
|
if (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'})) { |
if (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'})) { |
# Current user has login modification privileges |
# Current user has login modification privileges |
$r->print(<<ENDOTHERAUTHS); |
$r->print(<<ENDOTHERAUTHS); |
Line 707 END
|
Line 758 END
|
# Revoke roles |
# Revoke roles |
if ($_=~/^form\.rev/) { |
if ($_=~/^form\.rev/) { |
if ($_=~/^form\.rev\:([^\_]+)\_([^\_]+)$/) { |
if ($_=~/^form\.rev\:([^\_]+)\_([^\_]+)$/) { |
$r->print('Revoking '.$2.' in '.$1.': '. |
$r->print('Revoking '.$2.' in '.$1.': <b>'. |
&Apache::lonnet::assignrole($ENV{'form.ccdomain'}, |
&Apache::lonnet::assignrole($ENV{'form.ccdomain'}, |
$ENV{'form.ccuname'},$1,$2,$now).'<br>'); |
$ENV{'form.ccuname'},$1,$2,$now).'</b><br>'); |
if ($2 eq 'st') { |
if ($2 eq 'st') { |
$1=~/^\/(\w+)\/(\w+)/; |
$1=~/^\/(\w+)\/(\w+)/; |
my $cid=$1.'_'.$2; |
my $cid=$1.'_'.$2; |
$r->print('Drop from classlist: '. |
$r->print('Drop from classlist: <b>'. |
&Apache::lonnet::critical('put:'. |
&Apache::lonnet::critical('put:'. |
$ENV{'course.'.$cid.'.domain'}.':'. |
$ENV{'course.'.$cid.'.domain'}.':'. |
$ENV{'course.'.$cid.'.num'}.':classlist:'. |
$ENV{'course.'.$cid.'.num'}.':classlist:'. |
&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'}).'<br>'); |
$ENV{'course.'.$cid.'.home'}).'</b><br>'); |
|
} |
|
} |
|
} elsif ($_=~/^form\.del/) { |
|
if ($_=~/^form\.del\:([^\_]+)\_([^\_]+)$/) { |
|
$r->print('Deleting '.$2.' in '.$1.': '. |
|
&Apache::lonnet::assignrole($ENV{'form.ccdomain'}, |
|
$ENV{'form.ccuname'},$1,$2,$now,0,1).'<br>'); |
|
if ($2 eq 'st') { |
|
$1=~/^\/(\w+)\/(\w+)/; |
|
my $cid=$1.'_'.$2; |
|
$r->print('Drop from classlist: <b>'. |
|
&Apache::lonnet::critical('put:'. |
|
$ENV{'course.'.$cid.'.domain'}.':'. |
|
$ENV{'course.'.$cid.'.num'}.':classlist:'. |
|
&Apache::lonnet::escape($ENV{'form.ccuname'}.':'. |
|
$ENV{'form.ccdomain'}).'='. |
|
&Apache::lonnet::escape($now.':'), |
|
$ENV{'course.'.$cid.'.home'}).'</b><br>'); |
} |
} |
} |
} |
} elsif ($_=~/^form\.act/) { |
} elsif ($_=~/^form\.act/) { |
if ($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_([^\_]+)$/) { |
if ($_=~/^form\.act\_([^\_]+)\_([^\_]+)\_([^\_]+)$/) { |
# Activate roles for sections with 3 id numbers |
# Activate roles for sections with 3 id numbers |
# set start, end times, and the url for the class |
# set start, end times, and the url for the class |
my $start = ( $ENV{'form.start_'.$1.'_'.$2} ? |
|
$ENV{'form.start_'.$1.'_'.$2} : |
my $start = ( $ENV{'form.start_'.$1.'_'.$2.'_'.$3} ? |
|
$ENV{'form.start_'.$1.'_'.$2.'_'.$3} : |
$now ); |
$now ); |
my $end = ( $ENV{'form.end_'.$1.'_'.$2} ? |
my $end = ( $ENV{'form.end_'.$1.'_'.$2.'_'.$3} ? |
$ENV{'form.end_'.$1.'_'.$2} : |
$ENV{'form.end_'.$1.'_'.$2.'_'.$3} : |
0 ); |
0 ); |
my $url='/'.$1.'/'.$2; |
my $url='/'.$1.'/'.$2; |
if ($ENV{'form.sec_'.$1.'_'.$2.'_'.$3}) { |
if ($ENV{'form.sec_'.$1.'_'.$2.'_'.$3}) { |
$url.='/'.$ENV{'form.sec_'.$1.'_'.$2.'_'.$3}; |
$url.='/'.$ENV{'form.sec_'.$1.'_'.$2.'_'.$3}; |
} |
} |
# Assign the role and report it |
# Assign the role and report it |
$r->print('Assigning: '.$3.' in '.$url.': '. |
$r->print('Assigning: '.$3.' in '.$url. |
|
($start?', starting '.localtime($start):''). |
|
($end?', ending '.localtime($end):'').': <b>'. |
&Apache::lonnet::assignrole( |
&Apache::lonnet::assignrole( |
$ENV{'form.ccdomain'},$ENV{'form.ccuname'}, |
$ENV{'form.ccdomain'},$ENV{'form.ccuname'}, |
$url,$3,$end,$start). |
$url,$3,$end,$start). |
'<br>'); |
'</b><br>'); |
# Handle students differently |
# Handle students differently |
if ($3 eq 'st') { |
if ($3 eq 'st') { |
$url=~/^\/(\w+)\/(\w+)/; |
$url=~/^\/(\w+)\/(\w+)/; |
my $cid=$1.'_'.$2; |
my $cid=$1.'_'.$2; |
$r->print('Add to classlist: '. |
$r->print('Add to classlist: <b>'. |
&Apache::lonnet::critical( |
&Apache::lonnet::critical( |
'put:'.$ENV{'course.'.$cid.'.domain'}.':'. |
'put:'.$ENV{'course.'.$cid.'.domain'}.':'. |
$ENV{'course.'.$cid.'.num'}.':classlist:'. |
$ENV{'course.'.$cid.'.num'}.':classlist:'. |
Line 756 END
|
Line 828 END
|
$ENV{'form.ccdomain'} ).'='. |
$ENV{'form.ccdomain'} ).'='. |
&Apache::lonnet::escape($end.':'.$start), |
&Apache::lonnet::escape($end.':'.$start), |
$ENV{'course.'.$cid.'.home'}) |
$ENV{'course.'.$cid.'.home'}) |
.'<br>'); |
.'</b><br>'); |
} |
} |
} elsif ($_=~/^form\.act\_([^\_]+)\_([^\_]+)$/) { |
} elsif ($_=~/^form\.act\_([^\_]+)\_([^\_]+)$/) { |
# Activate roles for sections with two id numbers |
# Activate roles for sections with two id numbers |
Line 770 END
|
Line 842 END
|
my $url='/'.$1.'/'; |
my $url='/'.$1.'/'; |
# Assign the role and report it. |
# Assign the role and report it. |
$r->print('Assigning: '.$2.' in '.$url.': '. |
$r->print('Assigning: '.$2.' in '.$url.': '. |
|
($start?', starting '.localtime($start):''). |
|
($end?', ending '.localtime($end):'').': <b>'. |
&Apache::lonnet::assignrole( |
&Apache::lonnet::assignrole( |
$ENV{'form.ccdomain'},$ENV{'form.ccuname'}, |
$ENV{'form.ccdomain'},$ENV{'form.ccuname'}, |
$url,$2,$end,$start) |
$url,$2,$end,$start) |
.'<br>'); |
.'</b><br>'); |
} |
} |
} |
} |
} # End of foreach (keys(%ENV)) |
} # End of foreach (keys(%ENV)) |
$r->print('</body></html>'); |
$r->print('</body></html>'); |
} |
} |
|
|
|
# ========================================================== Custom Role Editor |
|
|
|
sub custom_role_editor { |
|
my $r=shift; |
|
my $rolename=$ENV{'form.rolename'}; |
|
|
|
if ($rolename eq 'make new role') { |
|
$rolename=$ENV{'form.newrolename'}; |
|
} |
|
|
|
$rolename=~s/\W//gs; |
|
|
|
unless ($rolename) { |
|
&print_username_entry_form($r); |
|
return; |
|
} |
|
|
|
$r->print(&Apache::loncommon::bodytag( |
|
'Create Users, Change User Privileges').'<h2>'); |
|
my ($rdummy,$roledef)= |
|
&Apache::lonnet::get('roles',["rolesdef_$rolename"]); |
|
# ------------------------------------------------------- Does this role exist? |
|
if (($rdummy ne 'con_lost') && ($roledef ne '')) { |
|
$r->print('Existing Role "'); |
|
} else { |
|
$r->print('New Role "'); |
|
$roledef=''; |
|
} |
|
$r->print($rolename.'"</h2>'); |
|
# ------------------------------------------------------- What can be assigned? |
|
my %full=(); |
|
my %courselevel=(); |
|
foreach (split(/\:/,$Apache::lonnet::pr{'cr:c'})) { |
|
my ($priv,$restrict)=split(/\&/,$_); |
|
unless ($restrict) { $restrict='F'; } |
|
$courselevel{$priv}=$restrict; |
|
$full{$priv}=1; |
|
} |
|
my %domainlevel=(); |
|
foreach (split(/\:/,$Apache::lonnet::pr{'cr:d'})) { |
|
my ($priv,$restrict)=split(/\&/,$_); |
|
unless ($restrict) { $restrict='F'; } |
|
$domainlevel{$priv}=$restrict; |
|
$full{$priv}=1; |
|
} |
|
$r->print('<table border="2"><tr><th>Privilege</th><th>Course Level</th><th>Domain Level</th></tr>'); |
|
foreach (sort keys %full) { |
|
$r->print('<tr><td>'.&Apache::lonnet::plaintext($_).'</td><td>'. |
|
$courselevel{$_}.'</td><td>'.$domainlevel{$_}.'</td></tr>'); |
|
} |
|
$r->print('</table>'); |
|
$r->print('Not yet implemented.'); |
|
} |
|
|
# ================================================================ Main Handler |
# ================================================================ Main Handler |
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
Line 805 sub handler {
|
Line 933 sub handler {
|
&print_user_modification_page($r); |
&print_user_modification_page($r); |
} elsif ($ENV{'form.phase'} eq 'update_user_data') { |
} elsif ($ENV{'form.phase'} eq 'update_user_data') { |
&update_user_data($r); |
&update_user_data($r); |
|
} elsif ($ENV{'form.phase'} eq 'selected_custom_edit') { |
|
&custom_role_editor($r); |
} |
} |
} else { |
} else { |
$ENV{'user.error.msg'}= |
$ENV{'user.error.msg'}= |
Line 824 sub course_level_table {
|
Line 954 sub course_level_table {
|
$thiscourse=~s:_:/:g; |
$thiscourse=~s:_:/:g; |
my %coursedata=&Apache::lonnet::coursedescription($thiscourse); |
my %coursedata=&Apache::lonnet::coursedescription($thiscourse); |
my $area=$coursedata{'description'}; |
my $area=$coursedata{'description'}; |
|
if (!defined($area)) { $area='Unavailable course: '.$_; } |
my $bgcol=$thiscourse; |
my $bgcol=$thiscourse; |
$bgcol=~s/[^8-9b-e]//g; |
$bgcol=~s/[^8-9b-e]//g; |
$bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',0,6); |
$bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',0,6); |