version 1.30, 2002/04/18 20:16:43
|
version 1.33, 2002/04/23 21:05:45
|
Line 68 BEGIN {
|
Line 68 BEGIN {
|
$ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/; |
$ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/; |
my $krbdefdom=$1; |
my $krbdefdom=$1; |
$krbdefdom=~tr/a-z/A-Z/; |
$krbdefdom=~tr/a-z/A-Z/; |
$authformnop=(<<END); |
my %param = ( formname => 'document.cu', |
<p> |
kerb_def_dom => $krbdefdom |
<input type="radio" name="login" value="nochange" checked="checked" |
); |
onclick="changed_radio('nochange',document.cu);"> |
$loginscript = &Apache::loncommon::authform_header(%param); |
Do not change login data |
$generalrule = &Apache::loncommon::authform_authorwarning(%param); |
</p> |
$authformnop = &Apache::loncommon::authform_nochange(%param); |
END |
$authformkrb = &Apache::loncommon::authform_kerberos(%param); |
$authformkrb=(<<END); |
$authformint = &Apache::loncommon::authform_internal(%param); |
<p> |
$authformfsys = &Apache::loncommon::authform_filesystem(%param); |
<input type="radio" name="login" value="krb" |
$authformloc = &Apache::loncommon::authform_local(%param); |
onclick="changed_radio('krb',document.cu);"> |
|
Kerberos authenticated with domain |
|
<input type="text" size="10" name="krbarg" |
|
onclick="changed_text('krb',document.cu);" |
|
onchange="changed_text('krb',document.cu);"> |
|
</p> |
|
END |
|
$authformint=(<<END); |
|
<p> |
|
<input type="radio" name="login" value="int" |
|
onclick="changed_radio('int',document.cu);"> |
|
Internally authenticated (with initial password |
|
<input type="text" size="10" name="intarg" |
|
onclick="changed_text('int',document.cu);" |
|
onchange="changed_text('int',document.cu);"> |
|
</p> |
|
END |
|
$authformfsys=(<<END); |
|
<p> |
|
<input type="radio" name="login" value="fsys" |
|
onclick="changed_radio('fsys',document.cu);"> |
|
Filesystem authenticated (with initial password |
|
<input type="text" size="10" name="fsysarg" |
|
onclick="changed_text('fsys',document.cu);" |
|
onchange="changed_text('fsys',document.cu);"> |
|
</p> |
|
END |
|
$authformloc=(<<END); |
|
<p> |
|
<input type="radio" name="login" value="loc" |
|
onclick="changed_radio('loc',document.cu);"> |
|
Local Authentication with argument |
|
<input type="text" size="10" name="locarg" |
|
onclick="changed_text('loc',document.cu);" |
|
onchange="changed_text('loc',document.cu);"> |
|
</p> |
|
END |
|
$loginscript=(<<ENDLOGINSCRIPT); |
|
<script> |
|
|
|
var authvalues = new Object(); |
|
authvalues.names = new Array('krbarg','intarg','fsysarg','locarg'); |
|
authvalues.defaults = new Array('MSU.EDU','','',''); |
|
|
|
function changed_radio(choice,currentform) { |
|
var choicearg = choice + 'arg'; |
|
if (currentform.elements[choicearg].value == '') { |
|
clear(currentform,authvalues.names); |
|
for (var i=0; i<authvalues.names.length; i++) { |
|
if (authvalues.names[i] == choicearg) { |
|
currentform.elements[choicearg].value = authvalues.defaults[i]; |
|
} |
|
} |
|
} |
|
} |
|
|
|
function changed_text(choice,currentform) { |
|
var choicearg = choice + 'arg'; |
|
if (currentform.elements[choicearg].value !='') { |
|
// clear the other values |
|
var keep = currentform.elements[choicearg].value; |
|
clear(currentform,authvalues.names); |
|
currentform.elements[choicearg].value = keep; |
|
// validate our value |
|
if (choice == 'krb') { |
|
currentform.elements[choicearg].value = keep.toUpperCase(); |
|
} |
|
// check the appropriate checkbox |
|
set_checked('login',choice,currentform); |
|
} |
|
} |
|
|
|
function clear(currentform,names) { |
|
for (var i=0; i< currentform.elements.length; i++) { |
|
for (var j = 0; j< names.length; j++) { |
|
if (currentform.elements[i].name == names[j]) { |
|
currentform.elements[i].value = ''; |
|
} |
|
} |
|
} |
|
} |
|
|
|
function set_checked(name,choice,currentform) { |
|
for (var i=0; i< currentform.elements.length; i++) { |
|
if (currentform.elements[i].name == name) { |
|
if (currentform.elements[i].value == choice) { |
|
currentform.elements[i].checked =true; |
|
} |
|
} |
|
} |
|
} |
|
|
|
</script> |
|
ENDLOGINSCRIPT |
|
$generalrule=<<END; |
|
<p> |
|
<i>As a general rule, only authors or co-authors should be filesystem |
|
authenticated (which allows access to the server filesystem).</i> |
|
</p> |
|
END |
|
} |
} |
|
|
# =================================================================== Phase one |
# =================================================================== Phase one |
Line 185 END
|
Line 85 END
|
sub phase_one { |
sub phase_one { |
my $r=shift; |
my $r=shift; |
my $defdom=$ENV{'user.domain'}; |
my $defdom=$ENV{'user.domain'}; |
$r->print(<<ENDDOCUMENT); |
my @domains = &Apache::loncommon::get_domains(); |
|
my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain'); |
|
$r->print(<<"ENDDOCUMENT"); |
<html> |
<html> |
<head> |
<head> |
<title>The LearningOnline Network with CAPA</title> |
<title>The LearningOnline Network with CAPA</title> |
Line 194 sub phase_one {
|
Line 96 sub phase_one {
|
<h1>Create User, Change User Privileges</h1> |
<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=two> |
|
<p> |
Username: <input type=text size=15 name=ccuname><br> |
Username: <input type=text size=15 name=ccuname><br> |
Domain: <input type=text size=15 name=ccdomain value=$defdom><p> |
Domain: $domform |
|
</p> |
<input type=submit value="Continue"> |
<input type=submit value="Continue"> |
</form> |
</form> |
</body> |
</body> |
Line 212 sub phase_two {
|
Line 116 sub phase_two {
|
$ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/; |
$ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/; |
my $krbdefdom=$1; |
my $krbdefdom=$1; |
$krbdefdom=~tr/a-z/A-Z/; |
$krbdefdom=~tr/a-z/A-Z/; |
|
my %param = ( formname => 'document.cu', |
|
kerb_def_dom => $krbdefdom |
|
); |
|
$loginscript = &Apache::loncommon::authform_header(%param); |
|
|
my $defdom=$ENV{'user.domain'}; |
my $defdom=$ENV{'user.domain'}; |
|
|
Line 221 sub phase_two {
|
Line 129 sub phase_two {
|
<html> |
<html> |
<head> |
<head> |
<title>The LearningOnline Network with CAPA</title> |
<title>The LearningOnline Network with CAPA</title> |
<script> |
<script type="text/javascript" language="Javascript"> |
|
|
function pclose() { |
function pclose() { |
parmwin=window.open("/adm/rat/empty.html","LONCAPAparms", |
parmwin=window.open("/adm/rat/empty.html","LONCAPAparms", |
Line 261 ENDFORMINFO
|
Line 169 ENDFORMINFO
|
my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain); |
my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain); |
my %incdomains; |
my %incdomains; |
my %inccourses; |
my %inccourses; |
my %home_servers = &get_home_servers($ccdomain); |
|
foreach (%Apache::lonnet::hostdom) { |
foreach (%Apache::lonnet::hostdom) { |
$incdomains{$_}=1; |
$incdomains{$_}=1; |
} |
} |
Line 272 ENDFORMINFO
|
Line 179 ENDFORMINFO
|
} |
} |
if ($uhome eq 'no_host') { |
if ($uhome eq 'no_host') { |
my $home_server_list= |
my $home_server_list= |
'<option value="default" selected>default</option>'."\n"; |
'<option value="default" selected>default</option>'."\n". |
foreach (sort keys(%home_servers)) { |
&Apache::loncommon::home_server_option_list($ccdomain); |
$home_server_list.= |
|
'<option value="'.$_.'">'.$_.' '. |
|
$home_servers{$_}."</option>\n"; |
|
} |
|
$r->print(<<ENDNEWUSER); |
$r->print(<<ENDNEWUSER); |
$dochead |
$dochead |
<h1>Create New User</h1> |
<h1>Create New User</h1> |
$forminfo |
$forminfo |
<h2>New user "$ccuname" in domain $ccdomain</h2> |
<h2>New user "$ccuname" in domain $ccdomain</h2> |
|
<script type="text/javascript" language="Javascript"> |
$loginscript |
$loginscript |
|
</script> |
<input type='hidden' name='makeuser' value='1' /> |
<input type='hidden' name='makeuser' value='1' /> |
<h3>Personal Data</h3> |
<h3>Personal Data</h3> |
<p> |
<p> |
Line 301 ID/Student Number <input type='text' nam
|
Line 207 ID/Student Number <input type='text' nam
|
Home Server: <select name="hserver" size="1"> $home_server_list </select> |
Home Server: <select name="hserver" size="1"> $home_server_list </select> |
<hr /> |
<hr /> |
<h3>Login Data</h3> |
<h3>Login Data</h3> |
$generalrule |
<p>$generalrule </p> |
$authformkrb |
<p>$authformkrb </p> |
$authformint |
<p>$authformint </p> |
$authformfsys |
<p>$authformfsys</p> |
$authformloc |
<p>$authformloc </p> |
ENDNEWUSER |
ENDNEWUSER |
} else { # user already exists |
} else { # user already exists |
$r->print(<<ENDCHANGEUSER); |
$r->print(<<ENDCHANGEUSER); |
Line 410 END
|
Line 316 END
|
if ($currentauth=~/^krb4:/) { |
if ($currentauth=~/^krb4:/) { |
$currentauth=~/^krb4:(.*)/; |
$currentauth=~/^krb4:(.*)/; |
my $krbdefdom2=$1; |
my $krbdefdom2=$1; |
$loginscript=~s/vf\.krbdom\.value='.*?';/vf.krbdom.value='$krbdefdom2';/; |
my %param = ( formname => 'document.cu', |
|
kerb_def_dom => $krbdefdom |
|
); |
|
$loginscript = &Apache::loncommon::authform_header(%param); |
} |
} |
# Check for a bad authentication type |
# Check for a bad authentication type |
unless ($currentauth=~/^krb4:/ or |
unless ($currentauth=~/^krb4:/ or |
Line 421 END
|
Line 330 END
|
if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) { |
if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) { |
$r->print(<<ENDBADAUTH); |
$r->print(<<ENDBADAUTH); |
<hr /> |
<hr /> |
|
<script type="text/javascript" language="Javascript"> |
$loginscript |
$loginscript |
|
</script> |
<font color='#ff0000'>ERROR:</font> |
<font color='#ff0000'>ERROR:</font> |
This user has an unrecognized authentication scheme ($currentauth). |
This user has an unrecognized authentication scheme ($currentauth). |
Please specify login data below. |
Please specify login data below. |
<h3>Login Data</h3> |
<h3>Login Data</h3> |
$generalrule |
<p>$generalrule</p> |
$authformkrb |
<p>$authformkrb</p> |
$authformint |
<p>$authformint</p> |
$authformfsys |
<p>$authformfsys</p> |
$authformloc |
<p>$authformloc</p> |
ENDBADAUTH |
ENDBADAUTH |
} else { |
} else { |
# This user is not allowed to modify the users |
# This user is not allowed to modify the users |
# authentication scheme, so just notify them of the problem |
# authentication scheme, so just notify them of the problem |
$r->print(<<ENDBADAUTH); |
$r->print(<<ENDBADAUTH); |
<hr /> |
<hr /> |
|
<script type="text/javascript" language="Javascript"> |
$loginscript |
$loginscript |
|
</script> |
<font color="#ff0000"> ERROR: </font> |
<font color="#ff0000"> ERROR: </font> |
This user has an unrecognized authentication scheme ($currentauth). |
This user has an unrecognized authentication scheme ($currentauth). |
Please alert a domain coordinator of this situation. |
Please alert a domain coordinator of this situation. |
Line 449 ENDBADAUTH
|
Line 362 ENDBADAUTH
|
my $authform_other=''; |
my $authform_other=''; |
if ($currentauth=~/^krb4:/) { |
if ($currentauth=~/^krb4:/) { |
$authformcurrent=$authformkrb; |
$authformcurrent=$authformkrb; |
$authform_other=$authformint.$authformfsys.$authformloc; |
$authform_other="<p>$authformint</p>\n". |
# embarrassing script hack here |
"<p>$authformfsys</p><p>$authformloc</p>"; |
$loginscript=~s/login\[3\]/login\[4\]/; # loc |
|
$loginscript=~s/login\[2\]/login\[3\]/; # fsys |
|
$loginscript=~s/login\[1\]/login\[2\]/; # int |
|
$loginscript=~s/login\[0\]/login\[1\]/; # krb4 |
|
} |
} |
elsif ($currentauth=~/^internal:/) { |
elsif ($currentauth=~/^internal:/) { |
$authformcurrent=$authformint; |
$authformcurrent=$authformint; |
$authform_other=$authformkrb.$authformfsys.$authformloc; |
$authform_other="<p>$authformkrb</p>". |
# embarrassing script hack here |
"<p>$authformfsys</p><p>$authformloc</p>"; |
$loginscript=~s/login\[3\]/login\[4\]/; # loc |
|
$loginscript=~s/login\[2\]/login\[3\]/; # fsys |
|
$loginscript=~s/login\[1\]/login\[1\]/; # int |
|
$loginscript=~s/login\[0\]/login\[2\]/; # krb4 |
|
} |
} |
elsif ($currentauth=~/^unix:/) { |
elsif ($currentauth=~/^unix:/) { |
$authformcurrent=$authformfsys; |
$authformcurrent=$authformfsys; |
$authform_other=$authformkrb.$authformint.$authformloc; |
$authform_other="<p>$authformkrb</p>". |
# embarrassing script hack here |
"<p>$authformint</p><p>$authformloc;</p>"; |
$loginscript=~s/login\[3\]/login\[4\]/; # loc |
|
$loginscript=~s/login\[1\]/login\[3\]/; # int |
|
$loginscript=~s/login\[2\]/login\[1\]/; # fsys |
|
$loginscript=~s/login\[0\]/login\[2\]/; # krb4 |
|
} |
} |
elsif ($currentauth=~/^localauth:/) { |
elsif ($currentauth=~/^localauth:/) { |
$authformcurrent=$authformloc; |
$authformcurrent=$authformloc; |
$authform_other=$authformkrb.$authformint.$authformfsys; |
$authform_other="<p>$authformkrb</p>". |
# embarrassing script hack here |
"<p>$authformint</p><p>$authformfsys</p>"; |
$loginscript=~s/login\[3\]/login\[loc\]/; # loc |
|
$loginscript=~s/login\[2\]/login\[4\]/; # fsys |
|
$loginscript=~s/login\[1\]/login\[3\]/; # int |
|
$loginscript=~s/login\[0\]/login\[2\]/; # krb4 |
|
$loginscript=~s/login\[loc\]/login\[1\]/; # loc |
|
} |
} |
$authformcurrent=<<ENDCURRENTAUTH; |
$authformcurrent=<<ENDCURRENTAUTH; |
<table border='1'> |
<table border='1'> |
Line 498 ENDCURRENTAUTH
|
Line 394 ENDCURRENTAUTH
|
# Current user has login modification privileges |
# Current user has login modification privileges |
$r->print(<<ENDOTHERAUTHS); |
$r->print(<<ENDOTHERAUTHS); |
<hr /> |
<hr /> |
|
<script type="text/javascript" language="Javascript"> |
$loginscript |
$loginscript |
|
</script> |
<h3>Change Current Login Data</h3> |
<h3>Change Current Login Data</h3> |
$generalrule |
<p>$generalrule</p> |
$authformnop |
<p>$authformnop</p> |
$authformcurrent |
<p>$authformcurrent</p> |
<h3>Enter New Login Data</h3> |
<h3>Enter New Login Data</h3> |
$authform_other |
$authform_other |
ENDOTHERAUTHS |
ENDOTHERAUTHS |
Line 654 ENDNEWUSERHEAD
|
Line 552 ENDNEWUSERHEAD
|
if (lc($desiredhost) eq 'default') { |
if (lc($desiredhost) eq 'default') { |
$desiredhost = undef; |
$desiredhost = undef; |
} else { |
} else { |
my %home_servers = &get_home_servers($ENV{'form.ccdomain'}); |
my %home_servers = &Apache::loncommon::get_home_servers |
|
($ENV{'form.ccdomain'}); |
if (! exists($home_servers{$desiredhost})) { |
if (! exists($home_servers{$desiredhost})) { |
$r->print($error.'Invalid home server specified'); |
$r->print($error.'Invalid home server specified'); |
return; |
return; |
Line 685 ENDMODIFYUSERHEAD
|
Line 584 ENDMODIFYUSERHEAD
|
# Only allow authentification modification if the person has authority |
# Only allow authentification modification if the person has authority |
if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) { |
if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) { |
$r->print('Modifying authentication: '. |
$r->print('Modifying authentication: '. |
&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>Home server: '.&Apache::lonnet::homeserver |
$r->print('<br>Home server: '.&Apache::lonnet::homeserver |
Line 934 ENDTABLE
|
Line 833 ENDTABLE
|
#---------------------------------------------- end functions for &phase_two |
#---------------------------------------------- end functions for &phase_two |
|
|
#--------------------------------- functions for &phase_two and &phase_three |
#--------------------------------- functions for &phase_two and &phase_three |
sub get_home_servers { |
|
my $domain = shift; |
|
my %home_servers; |
|
foreach (keys(%Apache::lonnet::libserv)) { |
|
if ($Apache::lonnet::hostdom{$_} eq $domain) { |
|
$home_servers{$_} = $Apache::lonnet::hostname{$_}; |
|
} |
|
} |
|
return %home_servers; |
|
} |
|
|
|
#--------------------------end of functions for &phase_two and &phase_three |
#--------------------------end of functions for &phase_two and &phase_three |
|
|