Diff for /loncom/interface/loncreateuser.pm between versions 1.39 and 1.39.4.1

version 1.39, 2002/08/08 19:27:35 version 1.39.4.1, 2002/08/30 22:06:56
Line 82  BEGIN { Line 82  BEGIN {
   
 # =================================================================== Phase one  # =================================================================== Phase one
   
 sub phase_one {  sub print_username_entry_form {
     my $r=shift;      my $r=shift;
     my $defdom=$ENV{'user.domain'};      my $defdom=$ENV{'request.role.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');
     $r->print(<<"ENDDOCUMENT");      $r->print(<<"ENDDOCUMENT");
Line 94  sub phase_one { Line 94  sub phase_one {
 </head>  </head>
 <body bgcolor="#FFFFFF">  <body bgcolor="#FFFFFF">
 <h1>Create User, Change User Privileges</h1>  <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="two">
 <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 108  ENDDOCUMENT
 }  }
   
 # =================================================================== Phase two  # =================================================================== Phase two
 sub phase_two {  sub print_user_modification_page {
     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 phase_two { Line 121  sub phase_two {
                   );                    );
     $loginscript  = &Apache::loncommon::authform_header(%param);      $loginscript  = &Apache::loncommon::authform_header(%param);
   
     my $defdom=$ENV{'user.domain'};      my $defdom=$ENV{'request.role.domain'};
   
     $ccuname=~s/\W//g;      $ccuname=~s/\W//g;
     $ccdomain=~s/\W//g;      $ccdomain=~s/\W//g;
Line 159  sub phase_two { Line 159  sub phase_two {
 ENDDOCHEAD  ENDDOCHEAD
     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="three">  <input type="hidden" name="phase"       value="update_user_data">
 <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 302  END
                    if (($role_code eq 'ca') &&                      if (($role_code eq 'ca') && 
                        ($ENV{'request.role'} !~ /^dc/)) {                         ($ENV{'request.role'} !~ /^dc/)) {
                        if ($area !~                          if ($area !~ 
                            /^\/$ENV{'user.domain'}\/$ENV{'user.name'}/) {                             /^\/$ENV{'request.role.domain'}\/$ENV{'user.name'}/) {
                            $allowed = 0;                             $allowed = 0;
                        }                         }
                    }                     }
Line 342  END Line 342  END
  $currentauth=~/^internal:/ or   $currentauth=~/^internal:/ or
  $currentauth=~/^localauth:/   $currentauth=~/^localauth:/
  ) { # bad authentication scheme   ) { # bad authentication scheme
     if (&Apache::lonnet::allowed('mau',$ENV{'user.domain'})) {      if (&Apache::lonnet::allowed('mau',$ENV{'request.role.domain'})) {
  $r->print(<<ENDBADAUTH);   $r->print(<<ENDBADAUTH);
 <hr />  <hr />
 <script type="text/javascript" language="Javascript">  <script type="text/javascript" language="Javascript">
Line 405  ENDBADAUTH Line 405  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{'user.domain'})) {              if (&Apache::lonnet::allowed('mau',$ENV{'request.role.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 426  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{'user.domain'};          my $cudom=$ENV{'request.role.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 485  ENDDROW Line 484  ENDDROW
 }  }
   
 # ================================================================= Phase Three  # ================================================================= Phase Three
 sub phase_three {  sub update_user_data {
     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 778  sub handler { Line 777  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{'user.domain'})) ||          (&Apache::lonnet::allowed('cca',$ENV{'request.role.domain'})) ||
         (&Apache::lonnet::allowed('mau',$ENV{'user.domain'}))) {          (&Apache::lonnet::allowed('mau',$ENV{'request.role.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'}) {
    &phase_one($r);     &print_username_entry_form($r);
        }         }
        if ($ENV{'form.phase'} eq 'two') {         if ($ENV{'form.phase'} eq 'get_user_info') {
            &phase_two($r);             &print_user_modification_page($r);
        } elsif ($ENV{'form.phase'} eq 'three') {         } elsif ($ENV{'form.phase'} eq 'update_user_data') {
            &phase_three($r);             &update_user_data($r);
        }         }
    } else {     } else {
       $ENV{'user.error.msg'}=        $ENV{'user.error.msg'}=

Removed from v.1.39  
changed lines
  Added in v.1.39.4.1


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