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

version 1.39.6.1, 2002/09/05 16:44:22 version 1.46, 2002/12/30 14:10:58
Line 80  BEGIN { Line 80  BEGIN {
     $authformloc  = &Apache::loncommon::authform_local(%param);      $authformloc  = &Apache::loncommon::authform_local(%param);
 }  }
   
   
   
   # ==================================================== Figure out author access
   
   sub authorpriv {
       my ($auname,$audom)=@_;
       if (($auname ne $ENV{'user.name'}) ||
           (($audom ne $ENV{'user.domain'}) &&
            ($audom ne $ENV{'request.role.domain'}))) { return ''; }
       unless (&Apache::lonnet::allowed('cca',$audom)) { return ''; }
       return 1;
   }
   
 # =================================================================== Phase one  # =================================================================== Phase one
   
 sub print_username_entry_form {  sub print_username_entry_form {
Line 87  sub print_username_entry_form { Line 100  sub print_username_entry_form {
     my $defdom=$ENV{'request.role.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');
       my $bodytag =&Apache::loncommon::bodytag(
                                     'Create Users, Change User Privileges');
       my $selscript=&Apache::loncommon::studentbrowser_javascript();
       my $sellink=&Apache::loncommon::selectstudent_link
                                           ('crtuser','ccuname','ccdomain');
     $r->print(<<"ENDDOCUMENT");      $r->print(<<"ENDDOCUMENT");
 <html>  <html>
 <head>  <head>
 <title>The LearningOnline Network with CAPA</title>  <title>The LearningOnline Network with CAPA</title>
   $selscript
 </head>  </head>
 <body bgcolor="#FFFFFF">  $bodytag
 <h1>Create User, Change User Privileges</h1>  <form action="/adm/createuser" method="post" name="crtuser">
 <form action="/adm/createuser" method="post">  
 <input type="hidden" name="phase" value="get_user_info">  <input type="hidden" name="phase" value="get_user_info">
 <p>  <p>
 Username: <input type="text" size="15" name="ccuname"><br>  <table>
 Domain: $domform   <tr><td>Username:</td><td><input type="text" size="15" name="ccuname">
   </td><td rowspan="2">$sellink</td></tr><tr><td>
   Domain:</td><td>$domform</td></tr>
   </table> 
 </p>  </p>
 <input type="submit" value="Continue">  <input type="submit" value="Continue">
 </form>  </form>
Line 154  sub print_user_modification_page { Line 175  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="update_user_data">
Line 293  END Line 314  END
                        }                         }
                    }                     }
                }                 }
                # I have no idea what the hell the above code does                 if ($role_code eq 'ca') {
                # So the following is a check:                     $area=~/\/(\w+)\/(\w+)/;
                if ($allowed) {     if (&authorpriv($2,$1)) {
                    # If we are looking at a co-author role, make sure it is          $allowed=1;
                    # for the current users construction space before we let                      } else {
                    # them revoke it.                         $allowed=0;
                    if (($role_code eq 'ca') &&   
                        ($ENV{'request.role'} !~ /^dc/)) {  
                        if ($area !~   
                            /^\/$ENV{'request.role.domain'}\/$ENV{'user.name'}/) {  
                            $allowed = 0;  
                        }  
                    }                     }
                }                 }
                my $row = '';                 my $row = '';
Line 330  END Line 345  END
  my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain);   my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain);
  if ($currentauth=~/^krb(4|5):/) {   if ($currentauth=~/^krb(4|5):/) {
     $currentauth=~/^krb(4|5):(.*)/;      $currentauth=~/^krb(4|5):(.*)/;
     my $krbdefdom2=$1;      my $krbdefdom=$1;
             my %param = ( formname => 'document.cu',              my %param = ( formname => 'document.cu',
                           kerb_def_dom => $krbdefdom                             kerb_def_dom => $krbdefdom 
                           );                            );
Line 426  ENDOTHERAUTHS Line 441  ENDOTHERAUTHS
 #  #
 # Co-Author  # Co-Author
 #   # 
     if (&Apache::lonnet::allowed('cca',$ENV{'request.role.domain'})) {      if (&authorpriv($ENV{'user.name'},$ENV{'request.role.domain'}) &&
           ($ENV{'user.name'} ne $ccuname || $ENV{'user.domain'} ne $ccdomain)) {
           # No sense in assigning co-author role to yourself
  my $cuname=$ENV{'user.name'};   my $cuname=$ENV{'user.name'};
         my $cudom=$ENV{'request.role.domain'};          my $cudom=$ENV{'request.role.domain'};
        $r->print(<<ENDCOAUTH);         $r->print(<<ENDCOAUTH);
Line 497  sub update_user_data { Line 514  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 560  ENDTHREEHEAD Line 582  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 617  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) {

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


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