[LON-CAPA-cvs] cvs: loncom(krb5_added) /interface loncreateuser.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 05 Sep 2002 16:44:22 -0000
albertel Thu Sep 5 12:44:22 2002 EDT
Modified files: (Branch: krb5_added)
/loncom/interface loncreateuser.pm
Log:
- intergrating the 0.5.1 changes into the krb5 stuff
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.39 loncom/interface/loncreateuser.pm:1.39.6.1
--- loncom/interface/loncreateuser.pm:1.39 Thu Aug 8 15:27:35 2002
+++ loncom/interface/loncreateuser.pm Thu Sep 5 12:44:22 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.39 2002/08/08 19:27:35 matthew Exp $
+# $Id: loncreateuser.pm,v 1.39.6.1 2002/09/05 16:44:22 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -47,7 +47,7 @@
# 11/12,11/13,11/15 Scott Harrison
# 02/11/02 Matthew Hall
#
-# $Id: loncreateuser.pm,v 1.39 2002/08/08 19:27:35 matthew Exp $
+# $Id: loncreateuser.pm,v 1.39.6.1 2002/09/05 16:44:22 albertel Exp $
###
package Apache::loncreateuser;
@@ -82,9 +82,9 @@
# =================================================================== Phase one
-sub phase_one {
+sub print_username_entry_form {
my $r=shift;
- my $defdom=$ENV{'user.domain'};
+ my $defdom=$ENV{'request.role.domain'};
my @domains = &Apache::loncommon::get_domains();
my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain');
$r->print(<<"ENDDOCUMENT");
@@ -94,13 +94,13 @@
</head>
<body bgcolor="#FFFFFF">
<h1>Create User, Change User Privileges</h1>
-<form action=/adm/createuser method=post>
-<input type=hidden name=phase value=two>
+<form action="/adm/createuser" method="post">
+<input type="hidden" name="phase" value="get_user_info">
<p>
-Username: <input type=text size=15 name=ccuname><br>
+Username: <input type="text" size="15" name="ccuname"><br>
Domain: $domform
</p>
-<input type=submit value="Continue">
+<input type="submit" value="Continue">
</form>
</body>
</html>
@@ -108,7 +108,7 @@
}
# =================================================================== Phase two
-sub phase_two {
+sub print_user_modification_page {
my $r=shift;
my $ccuname=$ENV{'form.ccuname'};
my $ccdomain=$ENV{'form.ccdomain'};
@@ -121,7 +121,7 @@
);
$loginscript = &Apache::loncommon::authform_header(%param);
- my $defdom=$ENV{'user.domain'};
+ my $defdom=$ENV{'request.role.domain'};
$ccuname=~s/\W//g;
$ccdomain=~s/\W//g;
@@ -159,7 +159,7 @@
ENDDOCHEAD
my $forminfo =<<"ENDFORMINFO";
<form action="/adm/createuser" method="post" name="cu">
-<input type="hidden" name="phase" value="three">
+<input type="hidden" name="phase" value="update_user_data">
<input type="hidden" name="ccuname" value="$ccuname">
<input type="hidden" name="ccdomain" value="$ccdomain">
<input type="hidden" name="pres_value" value="" >
@@ -302,7 +302,7 @@
if (($role_code eq 'ca') &&
($ENV{'request.role'} !~ /^dc/)) {
if ($area !~
- /^\/$ENV{'user.domain'}\/$ENV{'user.name'}/) {
+ /^\/$ENV{'request.role.domain'}\/$ENV{'user.name'}/) {
$allowed = 0;
}
}
@@ -328,8 +328,8 @@
$r->print('</table>');
} # End of unless
my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain);
- if ($currentauth=~/^krb4:/) {
- $currentauth=~/^krb4:(.*)/;
+ if ($currentauth=~/^krb(4|5):/) {
+ $currentauth=~/^krb(4|5):(.*)/;
my $krbdefdom2=$1;
my %param = ( formname => 'document.cu',
kerb_def_dom => $krbdefdom
@@ -337,12 +337,12 @@
$loginscript = &Apache::loncommon::authform_header(%param);
}
# Check for a bad authentication type
- unless ($currentauth=~/^krb4:/ or
+ unless ($currentauth=~/^krb(4|5):/ or
$currentauth=~/^unix:/ or
$currentauth=~/^internal:/ or
$currentauth=~/^localauth:/
) { # bad authentication scheme
- if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) {
+ if (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'})) {
$r->print(<<ENDBADAUTH);
<hr />
<script type="text/javascript" language="Javascript">
@@ -375,7 +375,7 @@
} else { # Authentication type is valid
my $authformcurrent='';
my $authform_other='';
- if ($currentauth=~/^krb4:/) {
+ if ($currentauth=~/^krb(4|5):/) {
$authformcurrent=$authformkrb;
$authform_other="<p>$authformint</p>\n".
"<p>$authformfsys</p><p>$authformloc</p>";
@@ -405,7 +405,7 @@
<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{'user.domain'})) {
+ if (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'})) {
# Current user has login modification privileges
$r->print(<<ENDOTHERAUTHS);
<hr />
@@ -426,10 +426,9 @@
#
# Co-Author
#
-
- if (&Apache::lonnet::allowed('cca',$ENV{'user.domain'})) {
+ if (&Apache::lonnet::allowed('cca',$ENV{'request.role.domain'})) {
my $cuname=$ENV{'user.name'};
- my $cudom=$ENV{'user.domain'};
+ my $cudom=$ENV{'request.role.domain'};
$r->print(<<ENDCOAUTH);
<h4>Construction Space</h4>
<table border=2><tr><th>Activate</th><th>Role</th><th>Extent</th>
@@ -485,7 +484,7 @@
}
# ================================================================= Phase Three
-sub phase_three {
+sub update_user_data {
my $r=shift;
my $uhome=&Apache::lonnet::homeserver($ENV{'form.ccuname'},
$ENV{'form.ccdomain'});
@@ -535,7 +534,8 @@
my $amode='';
my $genpwd='';
if ($ENV{'form.login'} eq 'krb') {
- $amode='krb4';
+ $amode='krb';
+ $amode.=$ENV{'form.krbver'};
$genpwd=$ENV{'form.krbarg'};
} elsif ($ENV{'form.login'} eq 'int') {
$amode='internal';
@@ -778,17 +778,17 @@
(&Apache::lonnet::allowed('cin',$ENV{'request.course.id'})) ||
(&Apache::lonnet::allowed('ccr',$ENV{'request.course.id'})) ||
(&Apache::lonnet::allowed('cep',$ENV{'request.course.id'})) ||
- (&Apache::lonnet::allowed('cca',$ENV{'user.domain'})) ||
- (&Apache::lonnet::allowed('mau',$ENV{'user.domain'}))) {
+ (&Apache::lonnet::allowed('cca',$ENV{'request.role.domain'})) ||
+ (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'}))) {
$r->content_type('text/html');
$r->send_http_header;
unless ($ENV{'form.phase'}) {
- &phase_one($r);
+ &print_username_entry_form($r);
}
- if ($ENV{'form.phase'} eq 'two') {
- &phase_two($r);
- } elsif ($ENV{'form.phase'} eq 'three') {
- &phase_three($r);
+ if ($ENV{'form.phase'} eq 'get_user_info') {
+ &print_user_modification_page($r);
+ } elsif ($ENV{'form.phase'} eq 'update_user_data') {
+ &update_user_data($r);
}
} else {
$ENV{'user.error.msg'}=