--- loncom/interface/loncreateuser.pm 2007/12/21 14:05:40 1.214
+++ loncom/interface/loncreateuser.pm 2007/12/21 14:35:42 1.215
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.214 2007/12/21 14:05:40 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.215 2007/12/21 14:35:42 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -493,9 +493,10 @@ sub print_user_query_page {
}
sub print_user_modification_page {
- my ($r,$ccuname,$ccdomain,$srch,$response,$context) = @_;
+ my ($r,$ccuname,$ccdomain,$srch,$response,$context,$permission) = @_;
if (($ccuname eq '') || ($ccdomain eq '')) {
- my $usermsg = &mt('No username and/or domain provided.');
+ my $usermsg = &mt('No username and/or domain provided.');
+ $env{'form.phase'} = '';
&print_username_entry_form($r,$context,$usermsg);
return;
}
@@ -512,6 +513,30 @@ sub print_user_modification_page {
%alerts,%curr_rules,%got_rules);
my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain);
if ($uhome eq 'no_host') {
+ my $usertype;
+ my ($rules,$ruleorder) =
+ &Apache::lonnet::inst_userrules($ccdomain,'username');
+ $usertype =
+ &Apache::lonuserutils::check_usertype($ccdomain,$ccuname,$rules);
+ my $cancreate =
+ &Apache::lonuserutils::can_create_user($ccdomain,$context,
+ $usertype);
+ if (!$cancreate) {
+ my $helplink = ' href="javascript:helpMenu('."'display'".')"';
+ my %usertypetext = (
+ official => 'institutional',
+ unofficial => 'non-institutional',
+ );
+ my $response;
+ if ($env{'form.origform'} eq 'crtusername') {
+ $response = ''.&mt('No match was found for the username ([_1]) in LON-CAPA domain: [_2]',$ccuname,$ccdomain).
+ '
';
+ }
+ $response .= ''.&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.").' '.&mt('Contact the helpdesk for assistance.',$helplink).'
';
+ $env{'form.phase'} = '';
+ &print_username_entry_form($r,$context,$response);
+ return;
+ }
$newuser = 1;
my $checkhash;
my $checks = { 'username' => 1 };
@@ -532,9 +557,10 @@ sub print_user_modification_page {
$domdesc,$curr_rules{$ccdomain}{'username'},
'username');
}
+ $env{'form.phase'} = '';
&print_username_entry_form($r,$context,$userchkmsg);
return;
- }
+ }
}
}
} else {
@@ -549,7 +575,7 @@ sub print_user_modification_page {
}
}
if ($response) {
- $response = '
'.$response
+ $response = '
'.$response;
}
my $defdom=$env{'request.role.domain'};
@@ -569,7 +595,6 @@ sub print_user_modification_page {
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
my $dc_setcourse_code = '';
my $nondc_setsection_code = '';
-
my %loaditem;
my $groupslist;
@@ -835,7 +860,12 @@ ENDAUTH
} else {
$r->print(&Apache::lonuserutils::set_login($ccdomain,$authformkrb,$authformint,$authformloc));
}
- $r->print(''."\n".'