Diff for /loncom/interface/loncreateuser.pm between versions 1.226 and 1.227

version 1.226, 2007/12/31 02:28:12 version 1.227, 2008/01/01 17:24:59
Line 76  my $authformfsys; Line 76  my $authformfsys;
 my $authformloc;  my $authformloc;
   
 sub initialize_authen_forms {  sub initialize_authen_forms {
     my ($dom,$curr_authtype,$mode) = @_;       my ($dom,$formname,$curr_authtype,$mode) = @_;
     my ($krbdefdom)=( $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/);      my ($krbdef,$krbdefdom) = &Apache::loncommon::get_kerberos_defaults($dom);
     $krbdefdom= uc($krbdefdom);      my %param = ( formname => $formname,
     my %param = ( formname => 'document.cu',  
                   kerb_def_dom => $krbdefdom,                    kerb_def_dom => $krbdefdom,
                     kerb_def_auth => $krbdef,
                   domain => $dom,                    domain => $dom,
                 );                  );
     my %abv_auth = &auth_abbrev();      my %abv_auth = &auth_abbrev();
     if ($curr_authtype =~ /^(krb4|krb5|internal|localauth|unix):$/) {      if ($curr_authtype =~ /^(krb4|krb5|internal|localauth|unix):(.*)$/) {
         my $long_auth = $1;          my $long_auth = $1;
           my $curr_autharg = $2;
         my %abv_auth = &auth_abbrev();          my %abv_auth = &auth_abbrev();
         $param{'curr_authtype'} = $abv_auth{$long_auth};          $param{'curr_authtype'} = $abv_auth{$long_auth};
         if ($long_auth =~ /^krb(4|5)$/) {          if ($long_auth =~ /^krb(4|5)$/) {
             $param{'curr_kerb_ver'} = $1;              $param{'curr_kerb_ver'} = $1;
               $param{'curr_autharg'} = $curr_autharg;
         }          }
         if ($mode eq 'modifyuser') {          if ($mode eq 'modifyuser') {
             $param{'mode'} = $mode;              $param{'mode'} = $mode;
         }          }
     }      }
 # no longer static due to configurable kerberos defaults      $loginscript  = &Apache::loncommon::authform_header(%param);
 #    $loginscript  = &Apache::loncommon::authform_header(%param);      $authformkrb  = &Apache::loncommon::authform_kerberos(%param);
     $authformnop  = &Apache::loncommon::authform_nochange(%param);      $authformnop  = &Apache::loncommon::authform_nochange(%param);
 # no longer static due to configurable kerberos defaults  
 #    $authformkrb  = &Apache::loncommon::authform_kerberos(%param);  
     $authformint  = &Apache::loncommon::authform_internal(%param);      $authformint  = &Apache::loncommon::authform_internal(%param);
     $authformfsys = &Apache::loncommon::authform_filesystem(%param);      $authformfsys = &Apache::loncommon::authform_filesystem(%param);
     $authformloc  = &Apache::loncommon::authform_local(%param);      $authformloc  = &Apache::loncommon::authform_local(%param);
Line 515  sub print_user_modification_page { Line 515  sub print_user_modification_page {
         $formname = 'cu';          $formname = 'cu';
     }      }
     my %abv_auth = &auth_abbrev();      my %abv_auth = &auth_abbrev();
     my ($curr_authtype,%rulematch,%inst_results,$curr_kerb_ver,$newuser,      my (%rulematch,%inst_results,$newuser,%alerts,%curr_rules,%got_rules);
         %alerts,%curr_rules,%got_rules);  
     my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain);      my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain);
     if ($uhome eq 'no_host') {      if ($uhome eq 'no_host') {
         my $usertype;          my $usertype;
Line 571  sub print_user_modification_page { Line 570  sub print_user_modification_page {
         }          }
     } else {      } else {
         $newuser = 0;          $newuser = 0;
         my $currentauth =   
             &Apache::lonnet::queryauthenticate($ccuname,$ccdomain);  
         if ($currentauth =~ /^(krb4|krb5|unix|internal|localauth):/) {  
             $curr_authtype = $abv_auth{$1};  
             if ($currentauth =~ /^krb(4|5)/) {  
                 $curr_kerb_ver = $1;  
             }  
         }  
     }      }
     if ($response) {      if ($response) {
         $response = '<br />'.$response;          $response = '<br />'.$response;
     }      }
     my $defdom=$env{'request.role.domain'};  
   
     my ($krbdef,$krbdefdom) =  
        &Apache::loncommon::get_kerberos_defaults($defdom);  
   
     my %param = ( formname => 'document.cu',  
                   kerb_def_dom => $krbdefdom,  
                   kerb_def_auth => $krbdef,  
                   curr_authtype => $curr_authtype,  
                   curr_kerb_ver => $curr_kerb_ver,  
                   domain => $ccdomain,  
                 );  
     $loginscript  = &Apache::loncommon::authform_header(%param);  
     $authformkrb  = &Apache::loncommon::authform_kerberos(%param);  
   
     my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();      my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
     my $dc_setcourse_code = '';      my $dc_setcourse_code = '';
Line 654  ENDFORMINFO Line 631  ENDFORMINFO
             # Current user has quota modification privileges              # Current user has quota modification privileges
             $portfolioform = '<br />'.&portfolio_quota($ccuname,$ccdomain);              $portfolioform = '<br />'.&portfolio_quota($ccuname,$ccdomain);
         }          }
         &initialize_authen_forms($ccdomain);          &initialize_authen_forms($ccdomain,$formname);
         my %lt=&Apache::lonlocal::texthash(          my %lt=&Apache::lonlocal::texthash(
                 'cnu'            => 'Create New User',                  'cnu'            => 'Create New User',
                 'ast'            => 'as a student',                  'ast'            => 'as a student',
Line 775  ENDCHANGEUSER Line 752  ENDCHANGEUSER
             $r->print(&Apache::lonuserutils::forceid_change($context));              $r->print(&Apache::lonuserutils::forceid_change($context));
         }          }
         $r->print('</div>');          $r->print('</div>');
         my $user_auth_text =           my $user_auth_text =  &user_authentication($ccuname,$ccdomain,$formname);
             &user_authentication($ccuname,$ccdomain,$krbdefdom,\%abv_auth);  
         my $user_quota_text;          my $user_quota_text;
         if (&Apache::lonnet::allowed('mpq',$ccdomain)) {          if (&Apache::lonnet::allowed('mpq',$ccdomain)) {
             # Current user has quota modification privileges              # Current user has quota modification privileges
Line 840  ENDNOPORTPRIV Line 816  ENDNOPORTPRIV
             if ($addrolesdisplay) {              if ($addrolesdisplay) {
                 $r->print('<br /><input type="button" value="'.&mt('Modify User').'"');                  $r->print('<br /><input type="button" value="'.&mt('Modify User').'"');
                 if ($newuser) {                  if ($newuser) {
                     $r->print(' onClick="verify_message(this.form)" \>'."\n");                      $r->print(' onClick="auth_check()" \>'."\n");
                 } else {                  } else {
                     $r->print('onClick="this.form.submit()" \>'."\n");                      $r->print('onClick="this.form.submit()" \>'."\n");
                 }                  }
Line 897  sub validation_javascript { Line 873  sub validation_javascript {
     if ($context eq 'domain') {      if ($context eq 'domain') {
         my $dcdom = $env{'request.role.domain'};          my $dcdom = $env{'request.role.domain'};
         $loaditem->{'onload'} = "document.cu.coursedesc.value='';";          $loaditem->{'onload'} = "document.cu.coursedesc.value='';";
         $dc_setcourse_code = &Apache::lonuserutils::dc_setcourse_js('cu','singleuser');          $dc_setcourse_code = 
               &Apache::lonuserutils::dc_setcourse_js('cu','singleuser',$context);
     } else {      } else {
         $nondc_setsection_code =          my $checkauth; 
             &Apache::lonuserutils::setsections_javascript($formname,$groupslist);          if (($newuser) || (&Apache::lonnet::allowed('mau',$ccdomain))) {
               $checkauth = 1;
           }
           if ($context eq 'course') {
               $nondc_setsection_code =
                   &Apache::lonuserutils::setsections_javascript($formname,$groupslist,
                                                                 undef,$checkauth);
           }
           if ($checkauth) {
               $nondc_setsection_code .= 
                   &Apache::lonuserutils::verify_authen($formname,$context);
           }
     }      }
     my $js = &user_modification_js($pjump_def,$dc_setcourse_code,      my $js = &user_modification_js($pjump_def,$dc_setcourse_code,
                                    $nondc_setsection_code,$groupslist);                                     $nondc_setsection_code,$groupslist);
   
     my ($jsback,$elements) = &crumb_utilities();      my ($jsback,$elements) = &crumb_utilities();
     my $javascript_validations;  
     if ((&Apache::lonnet::allowed('mau',$ccdomain)) || ($newuser)) {  
         my ($krbdef,$krbdefdom) =  
             &Apache::loncommon::get_kerberos_defaults($ccdomain);  
         $javascript_validations =  
             &Apache::lonuserutils::javascript_validations('createuser',$krbdefdom,undef,  
                                                           undef,$ccdomain);  
     }  
     $js .= "\n".      $js .= "\n".
            '<script type="text/javascript">'."\n".$jsback."\n".             '<script type="text/javascript">'."\n".$jsback."\n".'</script>';
            $javascript_validations.'</script>';  
     return $js;      return $js;
 }  }
   
Line 1241  sub new_domain_roles { Line 1219  sub new_domain_roles {
 }  }
   
 sub user_authentication {  sub user_authentication {
     my ($ccuname,$ccdomain,$krbdefdom,$abv_auth) = @_;      my ($ccuname,$ccdomain,$formname) = @_;
     my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain);      my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain);
     my ($loginscript,$outcome);      my $outcome;
     if ($currentauth=~/^(krb)(4|5):(.*)/) {  
         my $long_auth = $1.$2;  
         my $curr_kerb_ver = $2;  
         my $krbdefdom=$3;  
         my $curr_authtype = $abv_auth->{$long_auth};  
         my %param = ( formname      => 'document.cu',  
                       kerb_def_dom  => $krbdefdom,  
                       domain        => $ccdomain,  
                       curr_authtype => $curr_authtype,  
                       curr_kerb_ver => $curr_kerb_ver,  
                           );  
         $loginscript  = &Apache::loncommon::authform_header(%param);  
     }  
     # Check for a bad authentication type      # Check for a bad authentication type
     if ($currentauth !~ /^(krb4|krb5|unix|internal|localauth):/) {      if ($currentauth !~ /^(krb4|krb5|unix|internal|localauth):/) {
         # bad authentication scheme          # bad authentication scheme
Line 1268  sub user_authentication { Line 1233  sub user_authentication {
                        'ld'    => "Login Data"                         'ld'    => "Login Data"
         );          );
         if (&Apache::lonnet::allowed('mau',$ccdomain)) {          if (&Apache::lonnet::allowed('mau',$ccdomain)) {
             &initialize_authen_forms($ccdomain);              &initialize_authen_forms($ccdomain,$formname);
   
             my $choices = &Apache::lonuserutils::set_login($ccdomain,$authformkrb,$authformint,$authformloc);              my $choices = &Apache::lonuserutils::set_login($ccdomain,$authformkrb,$authformint,$authformloc);
             $outcome = <<ENDBADAUTH;              $outcome = <<ENDBADAUTH;
 <script type="text/javascript" language="Javascript">  <script type="text/javascript" language="Javascript">
Line 1289  $lt{'uuas'} ($currentauth). $lt{'adcs'}. Line 1255  $lt{'uuas'} ($currentauth). $lt{'adcs'}.
 ENDBADAUTH  ENDBADAUTH
         }          }
     } else { # Authentication type is valid      } else { # Authentication type is valid
         &initialize_authen_forms($ccdomain,$currentauth,'modifyuser');          &initialize_authen_forms($ccdomain,$formname,$currentauth,'modifyuser');
         my ($authformcurrent,$can_modify,@authform_others) =          my ($authformcurrent,$can_modify,@authform_others) =
             &modify_login_block($ccdomain,$currentauth);              &modify_login_block($ccdomain,$currentauth);
         if (&Apache::lonnet::allowed('mau',$ccdomain)) {          if (&Apache::lonnet::allowed('mau',$ccdomain)) {

Removed from v.1.226  
changed lines
  Added in v.1.227


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>