--- loncom/interface/loncreateuser.pm 2017/11/04 20:59:38 1.448 +++ loncom/interface/loncreateuser.pm 2018/03/23 01:01:21 1.449 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.448 2017/11/04 20:59:38 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.449 2018/03/23 01:01:21 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; } @@ -253,14 +256,15 @@ sub build_tools_display { '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', - 'requestcourses.placement'); - @usertools = ('official','unofficial','community','textbook','placement'); + '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(); @@ -543,6 +547,7 @@ sub courserequest_titles { community => 'Communities', textbook => 'Textbook', placement => 'Placement Tests', + lti => 'LTI Provider', norequest => 'Not allowed', approval => 'Approval by Dom. Coord.', validate => 'With validation', @@ -2200,7 +2205,7 @@ sub user_authentication { 'ld' => "Login Data" ); # Check for a bad authentication type - if ($currentauth !~ /^(krb4|krb5|unix|internal|localauth):/) { + if ($currentauth !~ /^(krb4|krb5|unix|internal|localauth|lti):/) { # bad authentication scheme if (&Apache::lonnet::allowed('mau',$ccdomain)) { &initialize_authen_forms($ccdomain,$formname); @@ -2279,6 +2284,8 @@ ENDBADAUTH $result = &mt('Currently using local (institutional) authentication.'); } elsif ($currentauth =~ /^unix:/) { $result = &mt('Currently Filesystem Authenticated.'); + } elsif ($currentauth =~ /^lti:/) { + $result = &mt('Currently LTi authenticated.'); } $outcome = '

'.$lt{'ld'}.'

'. &Apache::loncommon::start_data_table(). @@ -2317,6 +2324,9 @@ sub modify_login_block { if ($can_assign{'loc'}) { push(@authform_others,$authformloc); } + if ($can_assign{'lti'}) { + push(@authform_others,$authformlti); + } if (($can_assign{'krb4'}) || ($can_assign{'krb5'})) { $show_override_msg = 1; } @@ -2328,6 +2338,9 @@ sub modify_login_block { if ($can_assign{'loc'}) { push(@authform_others,$authformloc); } + if ($can_assign{'lti'}) { + push(@authform_others,$authformlti); + } if ($can_assign{'int'}) { $show_override_msg = 1; } @@ -2342,6 +2355,9 @@ sub modify_login_block { if ($can_assign{'loc'}) { push(@authform_others,$authformloc); } + if ($can_assign{'lti'}) { + push(@authform_others,$authformlti); + } if ($can_assign{'fsys'}) { $show_override_msg = 1; } @@ -2353,9 +2369,23 @@ sub modify_login_block { if ($can_assign{'int'}) { push(@authform_others,$authformint); } + if ($can_assign{'lti'}) { + push(@authform_others,$authformlti); + } if ($can_assign{'loc'}) { $show_override_msg = 1; } + } elsif ($currentauth=~/^lti:/) { + $authformcurrent=$authformlti; + if (($can_assign{'krb4'}) || ($can_assign{'krb5'})) { + push(@authform_others,$authformkrb); + } + if ($can_assign{'int'}) { + push(@authform_others,$authformint); + } + if ($can_assign{'loc'}) { + push(@authform_others,$authformloc); + } } if ($show_override_msg) { $authformcurrent = '
'.$authformcurrent. @@ -2814,6 +2844,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 @@ -2833,7 +2866,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','placement'); + my @requestcourses = ('official','unofficial','community','textbook','placement','lti'); my @requestauthor = ('requestauthor'); my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($env{'form.ccdomain'}); @@ -3299,7 +3332,7 @@ sub update_user_data { foreach my $key (keys(%changed)) { if (($key eq 'official') || ($key eq 'unofficial') || ($key eq 'community') || ($key eq 'textbook') || - ($key eq 'placement')) { + ($key eq 'placement') || ($key eq 'lti')) { $newenvhash{'environment.requestcourses.'.$key} = $changeHash{'requestcourses.'.$key}; if ($changeHash{'requestcourses.'.$key}) { @@ -3509,6 +3542,7 @@ sub display_userinfo { '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:',