version 1.39.4.2, 2002/09/03 20:46:04
|
version 1.40, 2002/08/21 17:18:08
|
Line 82 BEGIN {
|
Line 82 BEGIN {
|
|
|
# =================================================================== Phase one |
# =================================================================== Phase one |
|
|
sub print_username_entry_form { |
sub phase_one { |
my $r=shift; |
my $r=shift; |
my $defdom=$ENV{'request.role.domain'}; |
my $defdom=$ENV{'user.domain'}; |
my @domains = &Apache::loncommon::get_domains(); |
my @domains = &Apache::loncommon::get_domains(); |
my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain'); |
my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain'); |
|
my $bodytag =&Apache::loncommon::bodytag( |
|
'Create Users, Change User Privileges'); |
$r->print(<<"ENDDOCUMENT"); |
$r->print(<<"ENDDOCUMENT"); |
<html> |
<html> |
<head> |
<head> |
<title>The LearningOnline Network with CAPA</title> |
<title>The LearningOnline Network with CAPA</title> |
</head> |
</head> |
<body bgcolor="#FFFFFF"> |
$bodytag |
<h1>Create User, Change User Privileges</h1> |
<form action=/adm/createuser method=post> |
<form action="/adm/createuser" method="post"> |
<input type=hidden name=phase value=two> |
<input type="hidden" name="phase" value="get_user_info"> |
|
<p> |
<p> |
Username: <input type="text" size="15" name="ccuname"><br> |
Username: <input type=text size=15 name=ccuname><br> |
Domain: $domform |
Domain: $domform |
</p> |
</p> |
<input type="submit" value="Continue"> |
<input type=submit value="Continue"> |
</form> |
</form> |
</body> |
</body> |
</html> |
</html> |
Line 108 ENDDOCUMENT
|
Line 109 ENDDOCUMENT
|
} |
} |
|
|
# =================================================================== Phase two |
# =================================================================== Phase two |
sub print_user_modification_page { |
sub phase_two { |
my $r=shift; |
my $r=shift; |
my $ccuname=$ENV{'form.ccuname'}; |
my $ccuname=$ENV{'form.ccuname'}; |
my $ccdomain=$ENV{'form.ccdomain'}; |
my $ccdomain=$ENV{'form.ccdomain'}; |
Line 121 sub print_user_modification_page {
|
Line 122 sub print_user_modification_page {
|
); |
); |
$loginscript = &Apache::loncommon::authform_header(%param); |
$loginscript = &Apache::loncommon::authform_header(%param); |
|
|
my $defdom=$ENV{'request.role.domain'}; |
my $defdom=$ENV{'user.domain'}; |
|
|
$ccuname=~s/\W//g; |
$ccuname=~s/\W//g; |
$ccdomain=~s/\W//g; |
$ccdomain=~s/\W//g; |
Line 154 sub print_user_modification_page {
|
Line 155 sub print_user_modification_page {
|
|
|
</script> |
</script> |
</head> |
</head> |
<body bgcolor="#FFFFFF"> |
|
<img align="right" src="/adm/lonIcons/lonlogos.gif"> |
|
ENDDOCHEAD |
ENDDOCHEAD |
|
$r->print(&Apache::loncommon::bodytag( |
|
'Create Users, Change User Privileges')); |
my $forminfo =<<"ENDFORMINFO"; |
my $forminfo =<<"ENDFORMINFO"; |
<form action="/adm/createuser" method="post" name="cu"> |
<form action="/adm/createuser" method="post" name="cu"> |
<input type="hidden" name="phase" value="update_user_data"> |
<input type="hidden" name="phase" value="three"> |
<input type="hidden" name="ccuname" value="$ccuname"> |
<input type="hidden" name="ccuname" value="$ccuname"> |
<input type="hidden" name="ccdomain" value="$ccdomain"> |
<input type="hidden" name="ccdomain" value="$ccdomain"> |
<input type="hidden" name="pres_value" value="" > |
<input type="hidden" name="pres_value" value="" > |
Line 302 END
|
Line 303 END
|
if (($role_code eq 'ca') && |
if (($role_code eq 'ca') && |
($ENV{'request.role'} !~ /^dc/)) { |
($ENV{'request.role'} !~ /^dc/)) { |
if ($area !~ |
if ($area !~ |
/^\/$ENV{'request.role.domain'}\/$ENV{'user.name'}/) { |
/^\/$ENV{'user.domain'}\/$ENV{'user.name'}/) { |
$allowed = 0; |
$allowed = 0; |
} |
} |
} |
} |
Line 342 END
|
Line 343 END
|
$currentauth=~/^internal:/ or |
$currentauth=~/^internal:/ or |
$currentauth=~/^localauth:/ |
$currentauth=~/^localauth:/ |
) { # bad authentication scheme |
) { # bad authentication scheme |
if (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'})) { |
if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) { |
$r->print(<<ENDBADAUTH); |
$r->print(<<ENDBADAUTH); |
<hr /> |
<hr /> |
<script type="text/javascript" language="Javascript"> |
<script type="text/javascript" language="Javascript"> |
Line 405 ENDBADAUTH
|
Line 406 ENDBADAUTH
|
<td bgcolor='#cbbcbb'>Changing this value will overwrite existing authentication for the user; you should notify the user of this change.</td></tr> |
<td bgcolor='#cbbcbb'>Changing this value will overwrite existing authentication for the user; you should notify the user of this change.</td></tr> |
</table> |
</table> |
ENDCURRENTAUTH |
ENDCURRENTAUTH |
if (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'})) { |
if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) { |
# Current user has login modification privileges |
# Current user has login modification privileges |
$r->print(<<ENDOTHERAUTHS); |
$r->print(<<ENDOTHERAUTHS); |
<hr /> |
<hr /> |
Line 426 ENDOTHERAUTHS
|
Line 427 ENDOTHERAUTHS
|
# |
# |
# Co-Author |
# Co-Author |
# |
# |
if (&Apache::lonnet::allowed('cca',$ENV{'request.role.domain'})) { |
|
|
if (&Apache::lonnet::allowed('cca',$ENV{'user.domain'})) { |
my $cuname=$ENV{'user.name'}; |
my $cuname=$ENV{'user.name'}; |
my $cudom=$ENV{'request.role.domain'}; |
my $cudom=$ENV{'user.domain'}; |
$r->print(<<ENDCOAUTH); |
$r->print(<<ENDCOAUTH); |
<h4>Construction Space</h4> |
<h4>Construction Space</h4> |
<table border=2><tr><th>Activate</th><th>Role</th><th>Extent</th> |
<table border=2><tr><th>Activate</th><th>Role</th><th>Extent</th> |
Line 484 ENDDROW
|
Line 486 ENDDROW
|
} |
} |
|
|
# ================================================================= Phase Three |
# ================================================================= Phase Three |
sub update_user_data { |
sub phase_three { |
my $r=shift; |
my $r=shift; |
my $uhome=&Apache::lonnet::homeserver($ENV{'form.ccuname'}, |
my $uhome=&Apache::lonnet::homeserver($ENV{'form.ccuname'}, |
$ENV{'form.ccdomain'}); |
$ENV{'form.ccdomain'}); |
Line 497 sub update_user_data {
|
Line 499 sub update_user_data {
|
<head> |
<head> |
<title>The LearningOnline Network with CAPA</title> |
<title>The LearningOnline Network with CAPA</title> |
</head> |
</head> |
<body bgcolor="#FFFFFF"> |
|
<img align="right" src="/adm/lonIcons/lonlogos.gif"> |
|
ENDTHREEHEAD |
ENDTHREEHEAD |
|
my $title; |
|
if (exists($ENV{'form.makeuser'})) { |
|
$title='Set Privileges for New User'; |
|
} else { |
|
$title='Modify User Privileges'; |
|
} |
|
$r->print(&Apache::loncommon::bodytag($title)); |
# Check Inputs |
# Check Inputs |
if (! $ENV{'form.ccuname'} ) { |
if (! $ENV{'form.ccuname'} ) { |
$r->print($error.'No login name specified.'.$end); |
$r->print($error.'No login name specified.'.$end); |
Line 559 ENDTHREEHEAD
|
Line 566 ENDTHREEHEAD
|
if ($ENV{'form.makeuser'}) { |
if ($ENV{'form.makeuser'}) { |
# Create a new user |
# Create a new user |
$r->print(<<ENDNEWUSERHEAD); |
$r->print(<<ENDNEWUSERHEAD); |
<h1>Create User</h1> |
|
<h3>Creating user "$ENV{'form.ccuname'}" in domain "$ENV{'form.ccdomain'}"</h2> |
<h3>Creating user "$ENV{'form.ccuname'}" in domain "$ENV{'form.ccdomain'}"</h2> |
ENDNEWUSERHEAD |
ENDNEWUSERHEAD |
# Check for the authentication mode and password |
# Check for the authentication mode and password |
Line 595 ENDNEWUSERHEAD
|
Line 601 ENDNEWUSERHEAD
|
($ENV{'form.login'} ne '' )) { |
($ENV{'form.login'} ne '' )) { |
# Modify user privileges |
# Modify user privileges |
$r->print(<<ENDMODIFYUSERHEAD); |
$r->print(<<ENDMODIFYUSERHEAD); |
<h1>Change User Privileges</h1> |
|
<h2>User "$ENV{'form.ccuname'}" in domain "$ENV{'form.ccdomain'}"</h2> |
<h2>User "$ENV{'form.ccuname'}" in domain "$ENV{'form.ccdomain'}"</h2> |
ENDMODIFYUSERHEAD |
ENDMODIFYUSERHEAD |
if (! $amode || ! $genpwd) { |
if (! $amode || ! $genpwd) { |
Line 777 sub handler {
|
Line 782 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'})) || |
(&Apache::lonnet::allowed('cca',$ENV{'user.domain'})) || |
(&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'}))) { |
(&Apache::lonnet::allowed('mau',$ENV{'user.domain'}))) { |
$r->content_type('text/html'); |
$r->content_type('text/html'); |
$r->send_http_header; |
$r->send_http_header; |
unless ($ENV{'form.phase'}) { |
unless ($ENV{'form.phase'}) { |
&print_username_entry_form($r); |
&phase_one($r); |
} |
} |
if ($ENV{'form.phase'} eq 'get_user_info') { |
if ($ENV{'form.phase'} eq 'two') { |
&print_user_modification_page($r); |
&phase_two($r); |
} elsif ($ENV{'form.phase'} eq 'update_user_data') { |
} elsif ($ENV{'form.phase'} eq 'three') { |
&update_user_data($r); |
&phase_three($r); |
} |
} |
} else { |
} else { |
$ENV{'user.error.msg'}= |
$ENV{'user.error.msg'}= |