--- loncom/interface/loncreateuser.pm 2002/02/12 21:42:18 1.27
+++ loncom/interface/loncreateuser.pm 2003/07/19 00:51:05 1.63
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.27 2002/02/12 21:42:18 matthew Exp $
+# $Id: loncreateuser.pm,v 1.63 2003/07/19 00:51:05 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -25,29 +25,6 @@
#
# http://www.lon-capa.org/
#
-# (Create a course
-# (My Desk
-#
-# (Internal Server Error Handler
-#
-# (Login Screen
-# 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14,
-# 1/14/00,5/29,5/30,6/1,6/29,7/1,11/9 Gerd Kortemeyer)
-#
-# YEAR=2001
-# 3/1/1 Gerd Kortemeyer)
-#
-# 3/1 Gerd Kortemeyer)
-#
-# 2/14 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
-# 05/10,10/16 Gerd Kortemeyer
-# 11/12,11/13,11/15 Scott Harrison
-# 02/11/02 Matthew Hall
-#
-# $Id: loncreateuser.pm,v 1.27 2002/02/12 21:42:18 matthew Exp $
###
package Apache::loncreateuser;
@@ -55,6 +32,7 @@ package Apache::loncreateuser;
use strict;
use Apache::Constants qw(:common :http);
use Apache::lonnet;
+use Apache::loncommon;
my $loginscript; # piece of javascript used in two separate instances
my $generalrule;
@@ -68,163 +46,121 @@ BEGIN {
$ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/;
my $krbdefdom=$1;
$krbdefdom=~tr/a-z/A-Z/;
- $authformnop=(<
-
-Do not change login data
-
-END
- $authformkrb=(<
-
-Kerberos authenticated with domain
-
-
-END
- $authformint=(<
-
-Internally authenticated (with initial password
-)
-
-END
- $authformfsys=(<
-
-Filesystem authenticated (with initial password
-)
-
-END
- $authformloc=(<
-
-Local Authentication with argument
-
-
-END
- $loginscript=(<
-function setkrb(vf) {
- if (vf.krbdom.value!='') {
- vf.login[0].checked=true;
- vf.krbdom.value=vf.krbdom.value.toUpperCase();
- vf.intpwd.value='';
- vf.fsyspwd.value='';
- vf.locarg.value='';
- }
+ my %param = ( formname => 'document.cu',
+ kerb_def_dom => $krbdefdom
+ );
+# no longer static due to configurable kerberos defaults
+# $loginscript = &Apache::loncommon::authform_header(%param);
+ $generalrule = &Apache::loncommon::authform_authorwarning(%param);
+ $authformnop = &Apache::loncommon::authform_nochange(%param);
+# no longer static due to configurable kerberos defaults
+# $authformkrb = &Apache::loncommon::authform_kerberos(%param);
+ $authformint = &Apache::loncommon::authform_internal(%param);
+ $authformfsys = &Apache::loncommon::authform_filesystem(%param);
+ $authformloc = &Apache::loncommon::authform_local(%param);
}
-function setint(vf) {
- if (vf.intpwd.value!='') {
- vf.login[1].checked=true;
- vf.krbdom.value='';
- vf.fsyspwd.value='';
- vf.locarg.value='';
- }
-}
-function setfsys(vf) {
- if (vf.fsyspwd.value!='') {
- vf.login[2].checked=true;
- vf.krbdom.value='';
- vf.intpwd.value='';
- vf.locarg.value='';
- }
-}
-
-function setloc(vf) {
- if (vf.locarg.value!='') {
- vf.login[3].checked=true;
- vf.krbdom.value='';
- vf.intpwd.value='';
- vf.fsyspwd.value='';
- }
-}
+# ======================================================= Existing Custom Roles
-function clicknop(vf) {
- vf.krbdom.value='';
- vf.intpwd.value='';
- vf.fsyspwd.value='';
- vf.locarg.value='';
-}
-
-function clickkrb(vf) {
- vf.krbdom.value='$krbdefdom';
- vf.intpwd.value='';
- vf.fsyspwd.value='';
- vf.locarg.value='';
-}
-
-function clickint(vf) {
- vf.krbdom.value='';
- vf.fsyspwd.value='';
- vf.locarg.value='';
+sub my_custom_roles {
+ my %returnhash=();
+ my %rolehash=&Apache::lonnet::dump('roles');
+ foreach (keys %rolehash) {
+ if ($_=~/^rolesdef\_(\w+)$/) {
+ $returnhash{$1}=$1;
+ }
+ }
+ return %returnhash;
}
-function clickfsys(vf) {
- vf.krbdom.value='';
- vf.intpwd.value='';
- vf.locarg.value='';
-}
+# ==================================================== Figure out author access
-function clickloc(vf) {
- vf.krbdom.value='';
- vf.intpwd.value='';
- vf.fsyspwd.value='';
-}
-
-ENDLOGINSCRIPT
- $generalrule=<
-As a general rule, only authors or co-authors should be filesystem
-authenticated (which allows access to the server filesystem).
-
-END
+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
-sub phase_one {
+sub print_username_entry_form {
my $r=shift;
- my $defdom=$ENV{'user.domain'};
- $r->print(< 'Generate new role ...',%existingroles));
+ $r->print(<<"ENDDOCUMENT");
The LearningOnline Network with CAPA
+$selscript
-
-Create User, Change User Privileges
-
+