--- loncom/interface/loncreateuser.pm 2019/08/27 14:45:04 1.406.2.17 +++ loncom/interface/loncreateuser.pm 2019/04/29 22:19:24 1.451 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.406.2.17 2019/08/27 14:45:04 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.451 2019/04/29 22:19:24 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -78,6 +78,7 @@ my $authformkrb; my $authformint; my $authformfsys; my $authformloc; +my $authformlti; sub initialize_authen_forms { my ($dom,$formname,$curr_authtype,$mode) = @_; @@ -88,7 +89,7 @@ sub initialize_authen_forms { domain => $dom, ); my %abv_auth = &auth_abbrev(); - if ($curr_authtype =~ /^(krb4|krb5|internal|localauth|unix):(.*)$/) { + if ($curr_authtype =~ /^(krb4|krb5|internal|localauth|unix|lti):(.*)$/) { my $long_auth = $1; my $curr_autharg = $2; my %abv_auth = &auth_abbrev(); @@ -107,6 +108,7 @@ sub initialize_authen_forms { $authformint = &Apache::loncommon::authform_internal(%param); $authformfsys = &Apache::loncommon::authform_filesystem(%param); $authformloc = &Apache::loncommon::authform_local(%param); + $authformlti = &Apache::loncommon::authform_lti(%param); } sub auth_abbrev { @@ -116,6 +118,7 @@ sub auth_abbrev { internal => 'int', localauth => 'loc', unix => 'fsys', + lti => 'lti', ); return %abv_auth; } @@ -252,13 +255,16 @@ sub build_tools_display { 'unofficial' => 'Can request creation of unofficial courses', 'community' => 'Can request creation of communities', 'textbook' => 'Can request creation of textbook courses', + 'placement' => 'Can request creation of placement tests', + 'lti' => 'Can request creation of LTI courses', 'requestauthor' => 'Can request author space', ); if ($context eq 'requestcourses') { %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname, 'requestcourses.official','requestcourses.unofficial', - 'requestcourses.community','requestcourses.textbook'); - @usertools = ('official','unofficial','community','textbook'); + 'requestcourses.community','requestcourses.textbook', + 'requestcourses.placement','requestcourses.lti'); + @usertools = ('official','unofficial','community','textbook','placement','lti'); @options =('norequest','approval','autolimit','validate'); %validations = &Apache::lonnet::auto_courserequest_checks($ccdomain); %reqtitles = &courserequest_titles(); @@ -333,6 +339,7 @@ sub build_tools_display { '
'.$authformcurrent.
@@ -2465,7 +2525,7 @@ sub personal_data_display {
} else {
undef($condition);
}
- }
+ }
if ($excluded) {
unless ($excluded =~ /^\@[^\@]+$/) {
undef($condition);
@@ -2505,7 +2565,7 @@ sub personal_data_display {
$upasstwo.
&Apache::lonhtmlcommon::row_closure()."\n";
if ($usernameset eq 'free') {
- my $onclick = "toggleUsernameDisp(this,'selfcreateusername');";
+ my $onclick = "toggleUsernameDisp(this,'selfcreateusername');";
$output .= &Apache::lonhtmlcommon::row_title($lt{'username'},undef,'LC_oddrow_value')."\n".
&mt('Use e-mail address: ').
''."\n".
@@ -2825,6 +2885,9 @@ sub update_user_data {
$amode='localauth';
$genpwd=$env{'form.locarg'};
$genpwd=" " if (!$genpwd);
+ } elsif ($env{'form.login'} eq 'lti') {
+ $amode='lti';
+ $genpwd=" ";
} elsif (($env{'form.login'} eq 'nochange') ||
($env{'form.login'} eq '' )) {
# There is no need to tell the user we did not change what they
@@ -2844,7 +2907,7 @@ sub update_user_data {
my (%alerts,%rulematch,%inst_results,%curr_rules);
my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
my @usertools = ('aboutme','blog','webdav','portfolio');
- my @requestcourses = ('official','unofficial','community','textbook');
+ my @requestcourses = ('official','unofficial','community','textbook','placement','lti');
my @requestauthor = ('requestauthor');
my ($othertitle,$usertypes,$types) =
&Apache::loncommon::sorted_inst_types($env{'form.ccdomain'});
@@ -2992,7 +3055,7 @@ sub update_user_data {
($env{'form.ccuname'},$env{'form.ccdomain'}));
} else {
# Okay, this is a non-fatal error.
- $r->print($error.&mt('You do not have privileges to modify the authentication configuration for this user.').$end);
+ $r->print($error.&mt('You do not have the authority to modify this users authentication information.').$end);
}
} elsif (($env{'form.intarg'} ne '') &&
(&Apache::lonnet::queryauthenticate($env{'form.ccuname'},$env{'form.ccdomain'}) =~ /^internal:/) &&
@@ -3024,7 +3087,7 @@ sub update_user_data {
'requestcourses.community','requestcourses.textbook',
'reqcrsotherdom.official','reqcrsotherdom.unofficial',
'reqcrsotherdom.community','reqcrsotherdom.textbook',
- 'requestauthor'],
+ 'reqcrsotherdom.placement','requestauthor'],
$env{'form.ccdomain'},$env{'form.ccuname'});
my ($tmp) = keys(%userenv);
if ($tmp =~ /^(con_lost|error)/i) {
@@ -3315,8 +3378,9 @@ sub update_user_data {
($env{'user.domain'} eq $env{'form.ccdomain'})) {
my %newenvhash;
foreach my $key (keys(%changed)) {
- if (($key eq 'official') || ($key eq 'unofficial')
- || ($key eq 'community') || ($key eq 'textbook')) {
+ if (($key eq 'official') || ($key eq 'unofficial') ||
+ ($key eq 'community') || ($key eq 'textbook') ||
+ ($key eq 'placement') || ($key eq 'lti')) {
$newenvhash{'environment.requestcourses.'.$key} =
$changeHash{'requestcourses.'.$key};
if ($changeHash{'requestcourses.'.$key}) {
@@ -3382,7 +3446,7 @@ sub update_user_data {
\%newsettingstext);
if ($env{'form.cid'} ne $userenv{'id'}) {
&Apache::lonnet::idput($env{'form.ccdomain'},
- {$env{'form.ccuname'} => $env{'form.cid'}});
+ {$env{'form.ccuname'} => $env{'form.cid'}},$uhome,'ids');
if (($recurseid) &&
(&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}))) {
my $idresult =
@@ -3525,6 +3589,8 @@ sub display_userinfo {
'unofficial' => 'Can Request Unofficial Courses',
'community' => 'Can Request Communities',
'textbook' => 'Can Request Textbook Courses',
+ 'placement' => 'Can Request Placement Tests',
+ 'lti' => 'Can Request LTI Courses',
'requestauthor' => 'Can Request Author Role',
'inststatus' => "Affiliation",
'prvs' => 'Previous Value:',
@@ -4766,7 +4832,7 @@ sub handler {
if (! exists($env{'form.state'})) {
&Apache::lonuserutils::print_first_users_upload_form($r,$context);
} elsif ($env{'form.state'} eq 'got_file') {
- my $result =
+ my $result =
&Apache::lonuserutils::print_upload_manager_form($r,$context,
$permission,
$crstype,$showcredits);
@@ -5080,7 +5146,7 @@ sub handler {
&Apache::lonhtmlcommon::row_closure(1));
}
}
- if ($pickstart) {
+ if ($pickstart) {
$r->print(&Apache::lonhtmlcommon::end_pick_box().'');
} else {
$r->print(' '.&mt('No information to display for this account request.').' ');
@@ -5670,6 +5736,7 @@ sub print_main_menu {
groups => 'Community Groups',
},
);
+ $linktext{'Placement'} = $linktext{'Course'};
my %linktitle = (
'Course' => {
@@ -5684,6 +5751,8 @@ sub print_main_menu {
},
);
+ $linktitle{'Placement'} = $linktitle{'Course'};
+
push(@{ $menu[0]->{items} }, #Category: Single Users
{
linktext => $linktext{$crstype}{'single'},
@@ -6186,10 +6255,11 @@ ENDSCRIPT
} elsif ($curr_types eq '') {
$add_domtitle = &mt('Users in other domain:');
}
+ my ($trusted,$untrusted) = &Apache::lonnet::trusted_domains('enroll',$cdom);
$output .= &Apache::loncommon::start_data_table_row()
.' | '.$add_domtitle.' ' .&Apache::loncommon::select_dom_form('','selfenroll_newdom', - $includeempty,$showdomdesc,'','','',$readonly) + $includeempty,$showdomdesc,'',$trusted,$untrusted,$readonly) .'' .' | '.&Apache::loncommon::end_data_table_row()
.&Apache::loncommon::end_data_table();
@@ -8499,7 +8569,7 @@ sub user_search_result {
my $domd_chk = &domdirectorysrch_check($srch);
$response .= ''.$instd_chk.'