Diff for /loncom/interface/loncreateuser.pm between versions 1.42 and 1.47

version 1.42, 2002/08/23 19:43:11 version 1.47, 2003/02/03 18:03:52
Line 44 Line 44
 # 2/14,2/17,2/19,2/20,2/21,2/22,2/23,3/2,3/17,3/24,04/12 Gerd Kortemeyer  # 2/14,2/17,2/19,2/20,2/21,2/22,2/23,3/2,3/17,3/24,04/12 Gerd Kortemeyer
 # April Guy Albertelli  # April Guy Albertelli
 # 05/10,10/16 Gerd Kortemeyer   # 05/10,10/16 Gerd Kortemeyer 
 # 11/12,11/13,11/15 Scott Harrison  
 # 02/11/02 Matthew Hall  # 02/11/02 Matthew Hall
 #  #
 # $Id$  # $Id$
Line 80  BEGIN { Line 79  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 89  sub print_username_entry_form { Line 101  sub print_username_entry_form {
     my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain');      my $domform = &Apache::loncommon::select_dom_form($defdom,'ccdomain');
     my $bodytag =&Apache::loncommon::bodytag(      my $bodytag =&Apache::loncommon::bodytag(
                                   'Create Users, Change User Privileges');                                    '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>
 $bodytag  $bodytag
 <form action="/adm/createuser" method="post">  <form action="/adm/createuser" method="post" name="crtuser">
 <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 294  END Line 313  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 331  END Line 344  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 427  ENDOTHERAUTHS Line 440  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);

Removed from v.1.42  
changed lines
  Added in v.1.47


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