version 1.39.4.2, 2002/09/03 20:46:04
|
version 1.45, 2002/11/25 18:44:33
|
Line 80 BEGIN {
|
Line 80 BEGIN {
|
$authformloc = &Apache::loncommon::authform_local(%param); |
$authformloc = &Apache::loncommon::authform_local(%param); |
} |
} |
|
|
|
|
|
|
|
# ==================================================== Figure out author access |
|
|
|
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 ''; } |
|
return 1; |
|
} |
|
|
# =================================================================== Phase one |
# =================================================================== Phase one |
|
|
sub print_username_entry_form { |
sub print_username_entry_form { |
Line 87 sub print_username_entry_form {
|
Line 100 sub print_username_entry_form {
|
my $defdom=$ENV{'request.role.domain'}; |
my $defdom=$ENV{'request.role.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="get_user_info"> |
<input type="hidden" name="phase" value="get_user_info"> |
<p> |
<p> |
Username: <input type="text" size="15" name="ccuname"><br> |
<table> |
Domain: $domform |
<tr><td>Username:</td><td><input type="text" size="15" name="ccuname"> |
|
</td></tr><tr><td> |
|
Domain:</td><td>$domform</td></tr> |
|
</table> |
</p> |
</p> |
<input type="submit" value="Continue"> |
<input type="submit" value="Continue"> |
</form> |
</form> |
Line 154 sub print_user_modification_page {
|
Line 171 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="update_user_data"> |
Line 293 END
|
Line 310 END
|
} |
} |
} |
} |
} |
} |
# I have no idea what the hell the above code does |
if ($role_code eq 'ca') { |
# So the following is a check: |
$area=~/\/(\w+)\/(\w+)/; |
if ($allowed) { |
if (&authorpriv($2,$1)) { |
# If we are looking at a co-author role, make sure it is |
$allowed=1; |
# for the current users construction space before we let |
} else { |
# them revoke it. |
$allowed=0; |
if (($role_code eq 'ca') && |
|
($ENV{'request.role'} !~ /^dc/)) { |
|
if ($area !~ |
|
/^\/$ENV{'request.role.domain'}\/$ENV{'user.name'}/) { |
|
$allowed = 0; |
|
} |
|
} |
} |
} |
} |
my $row = ''; |
my $row = ''; |
Line 328 END
|
Line 339 END
|
$r->print('</table>'); |
$r->print('</table>'); |
} # End of unless |
} # End of unless |
my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain); |
my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain); |
if ($currentauth=~/^krb4:/) { |
if ($currentauth=~/^krb(4|5):/) { |
$currentauth=~/^krb4:(.*)/; |
$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 |
); |
); |
$loginscript = &Apache::loncommon::authform_header(%param); |
$loginscript = &Apache::loncommon::authform_header(%param); |
} |
} |
# Check for a bad authentication type |
# Check for a bad authentication type |
unless ($currentauth=~/^krb4:/ or |
unless ($currentauth=~/^krb(4|5):/ or |
$currentauth=~/^unix:/ or |
$currentauth=~/^unix:/ or |
$currentauth=~/^internal:/ or |
$currentauth=~/^internal:/ or |
$currentauth=~/^localauth:/ |
$currentauth=~/^localauth:/ |
Line 375 ENDBADAUTH
|
Line 386 ENDBADAUTH
|
} else { # Authentication type is valid |
} else { # Authentication type is valid |
my $authformcurrent=''; |
my $authformcurrent=''; |
my $authform_other=''; |
my $authform_other=''; |
if ($currentauth=~/^krb4:/) { |
if ($currentauth=~/^krb(4|5):/) { |
$authformcurrent=$authformkrb; |
$authformcurrent=$authformkrb; |
$authform_other="<p>$authformint</p>\n". |
$authform_other="<p>$authformint</p>\n". |
"<p>$authformfsys</p><p>$authformloc</p>"; |
"<p>$authformfsys</p><p>$authformloc</p>"; |
Line 426 ENDOTHERAUTHS
|
Line 437 ENDOTHERAUTHS
|
# |
# |
# Co-Author |
# Co-Author |
# |
# |
if (&Apache::lonnet::allowed('cca',$ENV{'request.role.domain'})) { |
if (&authorpriv($ENV{'user.name'},$ENV{'request.role.domain'}) && |
|
($ENV{'user.name'} ne $ccuname || $ENV{'user.domain'} ne $ccdomain)) { |
|
# No sense in assigning co-author role to yourself |
my $cuname=$ENV{'user.name'}; |
my $cuname=$ENV{'user.name'}; |
my $cudom=$ENV{'request.role.domain'}; |
my $cudom=$ENV{'request.role.domain'}; |
$r->print(<<ENDCOAUTH); |
$r->print(<<ENDCOAUTH); |
Line 497 sub update_user_data {
|
Line 510 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 534 ENDTHREEHEAD
|
Line 552 ENDTHREEHEAD
|
my $amode=''; |
my $amode=''; |
my $genpwd=''; |
my $genpwd=''; |
if ($ENV{'form.login'} eq 'krb') { |
if ($ENV{'form.login'} eq 'krb') { |
$amode='krb4'; |
$amode='krb'; |
|
$amode.=$ENV{'form.krbver'}; |
$genpwd=$ENV{'form.krbarg'}; |
$genpwd=$ENV{'form.krbarg'}; |
} elsif ($ENV{'form.login'} eq 'int') { |
} elsif ($ENV{'form.login'} eq 'int') { |
$amode='internal'; |
$amode='internal'; |
Line 559 ENDTHREEHEAD
|
Line 578 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 613 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) { |