Diff for /loncom/interface/loncreateuser.pm between versions 1.39.6.1 and 1.40

version 1.39.6.1, 2002/09/05 16:44:22 version 1.40, 2002/08/21 17:18:08
Line 82  BEGIN { Line 82  BEGIN {
   
 # =================================================================== Phase one  # =================================================================== Phase one
   
 sub print_username_entry_form {  sub phase_one {
     my $r=shift;      my $r=shift;
     my $defdom=$ENV{'request.role.domain'};      my $defdom=$ENV{'user.domain'};
     my @domains = &Apache::loncommon::get_domains();      my @domains = &Apache::loncommon::get_domains();
     my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain');      my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain');
       my $bodytag =&Apache::loncommon::bodytag(
                                     'Create Users, Change User Privileges');
     $r->print(<<"ENDDOCUMENT");      $r->print(<<"ENDDOCUMENT");
 <html>  <html>
 <head>  <head>
 <title>The LearningOnline Network with CAPA</title>  <title>The LearningOnline Network with CAPA</title>
 </head>  </head>
 <body bgcolor="#FFFFFF">  $bodytag
 <h1>Create User, Change User Privileges</h1>  <form action=/adm/createuser method=post>
 <form action="/adm/createuser" method="post">  <input type=hidden name=phase value=two>
 <input type="hidden" name="phase" value="get_user_info">  
 <p>  <p>
 Username: <input type="text" size="15" name="ccuname"><br>  Username: <input type=text size=15 name=ccuname><br>
 Domain: $domform   Domain: $domform 
 </p>  </p>
 <input type="submit" value="Continue">  <input type=submit value="Continue">
 </form>  </form>
 </body>  </body>
 </html>  </html>
Line 108  ENDDOCUMENT Line 109  ENDDOCUMENT
 }  }
   
 # =================================================================== Phase two  # =================================================================== Phase two
 sub print_user_modification_page {  sub phase_two {
     my $r=shift;      my $r=shift;
     my $ccuname=$ENV{'form.ccuname'};      my $ccuname=$ENV{'form.ccuname'};
     my $ccdomain=$ENV{'form.ccdomain'};      my $ccdomain=$ENV{'form.ccdomain'};
Line 121  sub print_user_modification_page { Line 122  sub print_user_modification_page {
                   );                    );
     $loginscript  = &Apache::loncommon::authform_header(%param);      $loginscript  = &Apache::loncommon::authform_header(%param);
   
     my $defdom=$ENV{'request.role.domain'};      my $defdom=$ENV{'user.domain'};
   
     $ccuname=~s/\W//g;      $ccuname=~s/\W//g;
     $ccdomain=~s/\W//g;      $ccdomain=~s/\W//g;
Line 154  sub print_user_modification_page { Line 155  sub print_user_modification_page {
   
 </script>  </script>
 </head>  </head>
 <body bgcolor="#FFFFFF">  
 <img align="right" src="/adm/lonIcons/lonlogos.gif">  
 ENDDOCHEAD  ENDDOCHEAD
       $r->print(&Apache::loncommon::bodytag(
                                        'Create Users, Change User Privileges'));
     my $forminfo =<<"ENDFORMINFO";      my $forminfo =<<"ENDFORMINFO";
 <form action="/adm/createuser" method="post" name="cu">  <form action="/adm/createuser" method="post" name="cu">
 <input type="hidden" name="phase"       value="update_user_data">  <input type="hidden" name="phase"       value="three">
 <input type="hidden" name="ccuname"     value="$ccuname">  <input type="hidden" name="ccuname"     value="$ccuname">
 <input type="hidden" name="ccdomain"    value="$ccdomain">  <input type="hidden" name="ccdomain"    value="$ccdomain">
 <input type="hidden" name="pres_value"  value="" >  <input type="hidden" name="pres_value"  value="" >
Line 302  END Line 303  END
                    if (($role_code eq 'ca') &&                      if (($role_code eq 'ca') && 
                        ($ENV{'request.role'} !~ /^dc/)) {                         ($ENV{'request.role'} !~ /^dc/)) {
                        if ($area !~                          if ($area !~ 
                            /^\/$ENV{'request.role.domain'}\/$ENV{'user.name'}/) {                             /^\/$ENV{'user.domain'}\/$ENV{'user.name'}/) {
                            $allowed = 0;                             $allowed = 0;
                        }                         }
                    }                     }
Line 328  END Line 329  END
    $r->print('</table>');     $r->print('</table>');
         }  # End of unless          }  # End of unless
  my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain);   my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain);
  if ($currentauth=~/^krb(4|5):/) {   if ($currentauth=~/^krb4:/) {
     $currentauth=~/^krb(4|5):(.*)/;      $currentauth=~/^krb4:(.*)/;
     my $krbdefdom2=$1;      my $krbdefdom2=$1;
             my %param = ( formname => 'document.cu',              my %param = ( formname => 'document.cu',
                           kerb_def_dom => $krbdefdom                             kerb_def_dom => $krbdefdom 
Line 337  END Line 338  END
             $loginscript  = &Apache::loncommon::authform_header(%param);              $loginscript  = &Apache::loncommon::authform_header(%param);
  }   }
  # Check for a bad authentication type   # Check for a bad authentication type
         unless ($currentauth=~/^krb(4|5):/ or          unless ($currentauth=~/^krb4:/ or
  $currentauth=~/^unix:/ or   $currentauth=~/^unix:/ or
  $currentauth=~/^internal:/ or   $currentauth=~/^internal:/ or
  $currentauth=~/^localauth:/   $currentauth=~/^localauth:/
  ) { # bad authentication scheme   ) { # bad authentication scheme
     if (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'})) {      if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) {
  $r->print(<<ENDBADAUTH);   $r->print(<<ENDBADAUTH);
 <hr />  <hr />
 <script type="text/javascript" language="Javascript">  <script type="text/javascript" language="Javascript">
Line 375  ENDBADAUTH Line 376  ENDBADAUTH
         } else { # Authentication type is valid          } else { # Authentication type is valid
     my $authformcurrent='';      my $authformcurrent='';
     my $authform_other='';      my $authform_other='';
     if ($currentauth=~/^krb(4|5):/) {      if ($currentauth=~/^krb4:/) {
  $authformcurrent=$authformkrb;   $authformcurrent=$authformkrb;
  $authform_other="<p>$authformint</p>\n".   $authform_other="<p>$authformint</p>\n".
                     "<p>$authformfsys</p><p>$authformloc</p>";                      "<p>$authformfsys</p><p>$authformloc</p>";
Line 405  ENDBADAUTH Line 406  ENDBADAUTH
 <td bgcolor='#cbbcbb'>Changing this value will overwrite existing authentication for the user; you should notify the user of this change.</td></tr>  <td bgcolor='#cbbcbb'>Changing this value will overwrite existing authentication for the user; you should notify the user of this change.</td></tr>
 </table>  </table>
 ENDCURRENTAUTH  ENDCURRENTAUTH
             if (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'})) {              if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) {
  # Current user has login modification privileges   # Current user has login modification privileges
  $r->print(<<ENDOTHERAUTHS);   $r->print(<<ENDOTHERAUTHS);
 <hr />  <hr />
Line 426  ENDOTHERAUTHS Line 427  ENDOTHERAUTHS
 #  #
 # Co-Author  # Co-Author
 #   # 
     if (&Apache::lonnet::allowed('cca',$ENV{'request.role.domain'})) {  
       if (&Apache::lonnet::allowed('cca',$ENV{'user.domain'})) {
  my $cuname=$ENV{'user.name'};   my $cuname=$ENV{'user.name'};
         my $cudom=$ENV{'request.role.domain'};          my $cudom=$ENV{'user.domain'};
        $r->print(<<ENDCOAUTH);         $r->print(<<ENDCOAUTH);
 <h4>Construction Space</h4>  <h4>Construction Space</h4>
 <table border=2><tr><th>Activate</th><th>Role</th><th>Extent</th>  <table border=2><tr><th>Activate</th><th>Role</th><th>Extent</th>
Line 484  ENDDROW Line 486  ENDDROW
 }  }
   
 # ================================================================= Phase Three  # ================================================================= Phase Three
 sub update_user_data {  sub phase_three {
     my $r=shift;      my $r=shift;
     my $uhome=&Apache::lonnet::homeserver($ENV{'form.ccuname'},      my $uhome=&Apache::lonnet::homeserver($ENV{'form.ccuname'},
                                           $ENV{'form.ccdomain'});                                            $ENV{'form.ccdomain'});
Line 497  sub update_user_data { Line 499  sub update_user_data {
 <head>  <head>
 <title>The LearningOnline Network with CAPA</title>  <title>The LearningOnline Network with CAPA</title>
 </head>  </head>
 <body bgcolor="#FFFFFF">  
 <img align="right" src="/adm/lonIcons/lonlogos.gif">  
 ENDTHREEHEAD  ENDTHREEHEAD
       my $title;
       if (exists($ENV{'form.makeuser'})) {
    $title='Set Privileges for New User';
       } else {
           $title='Modify User Privileges';
       }
       $r->print(&Apache::loncommon::bodytag($title));
     # Check Inputs      # Check Inputs
     if (! $ENV{'form.ccuname'} ) {      if (! $ENV{'form.ccuname'} ) {
  $r->print($error.'No login name specified.'.$end);   $r->print($error.'No login name specified.'.$end);
Line 534  ENDTHREEHEAD Line 541  ENDTHREEHEAD
     my $amode='';      my $amode='';
     my $genpwd='';      my $genpwd='';
     if ($ENV{'form.login'} eq 'krb') {      if ($ENV{'form.login'} eq 'krb') {
  $amode='krb';   $amode='krb4';
  $amode.=$ENV{'form.krbver'};  
  $genpwd=$ENV{'form.krbarg'};   $genpwd=$ENV{'form.krbarg'};
     } elsif ($ENV{'form.login'} eq 'int') {      } elsif ($ENV{'form.login'} eq 'int') {
  $amode='internal';   $amode='internal';
Line 560  ENDTHREEHEAD Line 566  ENDTHREEHEAD
     if ($ENV{'form.makeuser'}) {      if ($ENV{'form.makeuser'}) {
         # Create a new user          # Create a new user
  $r->print(<<ENDNEWUSERHEAD);   $r->print(<<ENDNEWUSERHEAD);
 <h1>Create User</h1>  
 <h3>Creating user "$ENV{'form.ccuname'}" in domain "$ENV{'form.ccdomain'}"</h2>  <h3>Creating user "$ENV{'form.ccuname'}" in domain "$ENV{'form.ccdomain'}"</h2>
 ENDNEWUSERHEAD  ENDNEWUSERHEAD
         # Check for the authentication mode and password          # Check for the authentication mode and password
Line 596  ENDNEWUSERHEAD Line 601  ENDNEWUSERHEAD
              ($ENV{'form.login'} ne ''        )) {               ($ENV{'form.login'} ne ''        )) {
  # Modify user privileges   # Modify user privileges
  $r->print(<<ENDMODIFYUSERHEAD);   $r->print(<<ENDMODIFYUSERHEAD);
 <h1>Change User Privileges</h1>  
 <h2>User "$ENV{'form.ccuname'}" in domain "$ENV{'form.ccdomain'}"</h2>  <h2>User "$ENV{'form.ccuname'}" in domain "$ENV{'form.ccdomain'}"</h2>
 ENDMODIFYUSERHEAD  ENDMODIFYUSERHEAD
         if (! $amode || ! $genpwd) {          if (! $amode || ! $genpwd) {
Line 778  sub handler { Line 782  sub handler {
         (&Apache::lonnet::allowed('cin',$ENV{'request.course.id'})) ||           (&Apache::lonnet::allowed('cin',$ENV{'request.course.id'})) || 
         (&Apache::lonnet::allowed('ccr',$ENV{'request.course.id'})) ||           (&Apache::lonnet::allowed('ccr',$ENV{'request.course.id'})) || 
         (&Apache::lonnet::allowed('cep',$ENV{'request.course.id'})) ||          (&Apache::lonnet::allowed('cep',$ENV{'request.course.id'})) ||
         (&Apache::lonnet::allowed('cca',$ENV{'request.role.domain'})) ||          (&Apache::lonnet::allowed('cca',$ENV{'user.domain'})) ||
         (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'}))) {          (&Apache::lonnet::allowed('mau',$ENV{'user.domain'}))) {
        $r->content_type('text/html');         $r->content_type('text/html');
        $r->send_http_header;         $r->send_http_header;
        unless ($ENV{'form.phase'}) {         unless ($ENV{'form.phase'}) {
    &print_username_entry_form($r);     &phase_one($r);
        }         }
        if ($ENV{'form.phase'} eq 'get_user_info') {         if ($ENV{'form.phase'} eq 'two') {
            &print_user_modification_page($r);             &phase_two($r);
        } elsif ($ENV{'form.phase'} eq 'update_user_data') {         } elsif ($ENV{'form.phase'} eq 'three') {
            &update_user_data($r);             &phase_three($r);
        }         }
    } else {     } else {
       $ENV{'user.error.msg'}=        $ENV{'user.error.msg'}=

Removed from v.1.39.6.1  
changed lines
  Added in v.1.40


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