--- loncom/interface/loncreateuser.pm 2019/07/30 13:55:16 1.406.2.16 +++ loncom/interface/loncreateuser.pm 2019/08/27 14:45:04 1.406.2.17 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.406.2.16 2019/07/30 13:55:16 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.406.2.17 2019/08/27 14:45:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1486,7 +1486,7 @@ ENDAUTH ($env{'request.role.domain'} eq $ccdomain)) { $user_text{'requestauthor'} = &domainrole_req($ccuname,$ccdomain); } - $user_text{'auth'} = &user_authentication($ccuname,$ccdomain,$formname); + $user_text{'auth'} = &user_authentication($ccuname,$ccdomain,$formname,$crstype,$permission); if ((&Apache::lonnet::allowed('mpq',$ccdomain)) || (&Apache::lonnet::allowed('mut',$ccdomain)) || (&Apache::lonnet::allowed('udp',$ccdomain))) { @@ -2164,7 +2164,7 @@ sub new_domain_roles { } sub user_authentication { - my ($ccuname,$ccdomain,$formname) = @_; + my ($ccuname,$ccdomain,$formname,$crstype,$permission) = @_; my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain); my $outcome; my %lt=&Apache::lonlocal::texthash( @@ -2236,6 +2236,43 @@ ENDBADAUTH } $outcome .= &Apache::loncommon::end_data_table(); } else { + if (($currentauth =~ /^internal:/) && + (&Apache::lonuserutils::can_change_internalpass($ccuname,$ccdomain,$crstype,$permission))) { + $outcome = <<"ENDJS"; + +ENDJS + + $outcome .= '

'.$lt{'ld'}.'

'. + &Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_row(). + ''.&mt('Internally authenticated').'
'.&mt("Change user's password?"). + ''.(' 'x2). + ''. + ''. + &Apache::loncommon::end_data_table_row(). + &Apache::loncommon::end_data_table(); + } if (&Apache::lonnet::allowed('udp',$ccdomain)) { # Current user has rights to view domain preferences for user's domain my $result; @@ -2670,7 +2707,7 @@ sub get_inststatuses { # ================================================================= Phase Three sub update_user_data { - my ($r,$context,$crstype,$brcrum,$showcredits) = @_; + my ($r,$context,$crstype,$brcrum,$showcredits,$permission) = @_; my $uhome=&Apache::lonnet::homeserver($env{'form.ccuname'}, $env{'form.ccdomain'}); # Error messages @@ -2955,8 +2992,15 @@ 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 the authority to modify this users authentication information.').$end); + $r->print($error.&mt('You do not have privileges to modify the authentication configuration for this user.').$end); } + } elsif (($env{'form.intarg'} ne '') && + (&Apache::lonnet::queryauthenticate($env{'form.ccuname'},$env{'form.ccdomain'}) =~ /^internal:/) && + (&Apache::lonuserutils::can_change_internalpass($env{'form.ccuname'},$env{'form.ccdomain'},$crstype,$permission))) { + $r->print('Modifying authentication: '. + &Apache::lonnet::modifyuserauth( + $env{'form.ccdomain'},$env{'form.ccuname'}, + 'internal',$env{'form.intarg'})); } $r->rflush(); # Finish display of header before time consuming actions start &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state); @@ -4862,7 +4906,7 @@ sub handler { &print_useraccesslogs_display($r,$ccuname,$ccdomain,$permission,$brcrum); } } elsif ($env{'form.phase'} eq 'update_user_data') { - &update_user_data($r,$context,$crstype,$brcrum,$showcredits); + &update_user_data($r,$context,$crstype,$brcrum,$showcredits,$permission); } else { &print_username_entry_form($r,$context,undef,$srch,undef,$crstype, $brcrum,$permission);