[LON-CAPA-cvs] cvs: loncom /interface lonrequestcourse.pm
raeburn
raeburn@source.lon-capa.org
Mon, 24 Jan 2011 00:59:50 -0000
raeburn Mon Jan 24 00:59:50 2011 EDT
Modified files:
/loncom/interface lonrequestcourse.pm
Log:
- Checking of right to create new user and of format rules for new username
when processing personnel included in course request skipped for existing users.
Index: loncom/interface/lonrequestcourse.pm
diff -u loncom/interface/lonrequestcourse.pm:1.61 loncom/interface/lonrequestcourse.pm:1.62
--- loncom/interface/lonrequestcourse.pm:1.61 Tue Jan 11 04:28:52 2011
+++ loncom/interface/lonrequestcourse.pm Mon Jan 24 00:59:50 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Request a course
#
-# $Id: lonrequestcourse.pm,v 1.61 2011/01/11 04:28:52 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.62 2011/01/24 00:59:50 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3163,7 +3163,7 @@
$enrollstart = '';
$enrollend = '';
}
- my (%alerts,%rulematch,%inst_results,%curr_rules,%got_rules,%disallowmsg);
+ my (%alerts,%rulematch,%inst_results,%curr_rules,%got_rules,%disallowmsg,%skipped);
for (my $i=0; $i<$env{'form.persontotal'}; $i++) {
my $uname = $env{'form.person_'.$i.'_uname'};
my $udom = $env{'form.person_'.$i.'_dom'};
@@ -3175,50 +3175,55 @@
lastname => $env{'form.person_'.$i.'_lastname'},
emailaddr => $env{'form.person_'.$i.'_emailaddr'},
};
- my $usertype = &get_usertype($udom,$uname,\%curr_rules,\%got_rules);
- if (&Apache::lonuserutils::can_create_user($udom,'requestcrs',$usertype)) {
- my ($allowed,$msg,$authtype,$authparam) =
- &check_newuser_rules($udom,$uname,\%alerts,\%rulematch,
- \%inst_results,\%curr_rules,\%got_rules);
- if ($allowed) {
- my %domdefaults = &Apache::lonnet::get_domain_defaults($udom);
- if ($usertype eq 'official') {
- if ($authtype eq '') {
- $authtype = $domdefaults{'auth_def'};
- $authparam = $domdefaults{'auth_arg_def'};
- } else {
- if ($authtype eq 'loc') {
- $authtype = 'localauth';
- } elsif ($authtype eq 'int') {
- $authtype = 'internal';
- }
- if ($authtype !~ /^(krb4|krb5|internal|localauth)$/) {
+ if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') {
+ my $usertype = &get_usertype($udom,$uname,\%curr_rules,\%got_rules);
+ if (&Apache::lonuserutils::can_create_user($udom,'requestcrs',$usertype)) {
+ my ($allowed,$msg,$authtype,$authparam) =
+ &check_newuser_rules($udom,$uname,\%alerts,\%rulematch,
+ \%inst_results,\%curr_rules,\%got_rules);
+ if ($allowed) {
+ my %domdefaults = &Apache::lonnet::get_domain_defaults($udom);
+ if ($usertype eq 'official') {
+ if ($authtype eq '') {
$authtype = $domdefaults{'auth_def'};
$authparam = $domdefaults{'auth_arg_def'};
+ } else {
+ if ($authtype eq 'loc') {
+ $authtype = 'localauth';
+ } elsif ($authtype eq 'int') {
+ $authtype = 'internal';
+ }
+ if ($authtype !~ /^(krb4|krb5|internal|localauth)$/) {
+ $authtype = $domdefaults{'auth_def'};
+ $authparam = $domdefaults{'auth_arg_def'};
+ }
+ }
+ } elsif ($usertype eq 'unofficial') {
+ if ($authtype eq '') {
+ $authtype = 'internal';
+ $authparam = '';
}
+ } else {
+ $authtype = $domdefaults{'auth_def'};
+ $authparam = $domdefaults{'auth_arg_def'};
}
- } elsif ($usertype eq 'unofficial') {
- if ($authtype eq '') {
- $authtype = 'internal';
- $authparam = '';
+ if (($authtype eq '') ||
+ (($authtype =~/^krb(4|5)$/) && ($authparam eq '')) ||
+ ($authtype !~ /^(krb4|krb5|internal|localauth)$/)) {
+ $skipped{$uname.':'.$udom} = 1;
+ next;
+ } else {
+ $personnel{$uname.':'.$udom}{'authtype'} = $authtype;
+ $personnel{$uname.':'.$udom}{'autharg'} = $authparam;
}
} else {
- $authtype = $domdefaults{'auth_def'};
- $authparam = $domdefaults{'auth_arg_def'};
- }
- if (($authtype eq '') ||
- (($authtype =~/^krb(4|5)$/) && ($authparam eq '')) ||
- ($authtype !~ /^(krb4|krb5|internal|localauth)$/)) {
+ $skipped{$uname.':'.$udom} = 1;
next;
- } else {
- $personnel{$uname.':'.$udom}{'authtype'} = $authtype;
- $personnel{$uname.':'.$udom}{'autharg'} = $authparam;
}
} else {
+ $skipped{$uname.':'.$udom} = 1;
next;
}
- } else {
- next;
}
}
my $role = $env{'form.person_'.$i.'_role'};
@@ -3265,6 +3270,11 @@
push(@baduname,$uname.':'.$udom);
}
}
+ if (keys(%skipped)) {
+ foreach my $key (keys(%skipped)) {
+ delete($personnel{$key});
+ }
+ }
my ($accessstart,$accessend) = &dates_from_form('accessstart','accessend');
my $autodrops = 0;
if ($env{'form.autodrops'}) {