Diff for /loncom/enrollment/Enrollment.pm between versions 1.9 and 1.12

version 1.9, 2003/12/15 05:39:40 version 1.12, 2004/03/18 16:46:28
Line 185  sub update_LC { Line 185  sub update_LC {
 # Check for section changes  # Check for section changes
                 unless ($$currlist{$uname}[$sec] eq $stuinfo[ $place{groupID} ]) {                  unless ($$currlist{$uname}[$sec] eq $stuinfo[ $place{groupID} ]) {
                     if ( ($$currlist{$uname}[$type] eq "auto") && ($adds == 1) ) {                      if ( ($$currlist{$uname}[$type] eq "auto") && ($adds == 1) ) {
                         my $modify_section_result = &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$$currlist{$uname}[$cend],$$currlist{$uname}[$cstart],'auto',$cid);  # Delete from roles.db for current section
                         if ($modify_section_result =~ /^ok/) {                          my $expiretime = time;
                             $$logmsg .= "Section for $uname switched from old section: ".$$currlist{$uname}[$sec] ." to new section: ".$stuinfo[ $place{groupID} ].".".$linefeed;                          my $uurl='/'.$cid;
                           $uurl=~s/\_/\//g;
                           if ($$currlist{$uname}[$sec]) {
                               $uurl.='/'.$$currlist{$uname}[$sec];
                           }
                           my $expire_role_result = &Apache::lonnet::assignrole($dom,$uname,$uurl,'st',$expiretime);
                           if ($expire_role_result eq 'ok') {
                               my $modify_section_result = &Apache::lonnet::modify_student_enrollment($dom,$uname,undef,undef,undef,undef,undef,$stuinfo[ $place{groupID} ],$$currlist{$uname}[$cend],$$currlist{$uname}[$cstart],'auto',$cid);
                               if ($modify_section_result =~ /^ok/) {
                                   $$logmsg .= "Section for $uname switched from old section: ".$$currlist{$uname}[$sec] ." to new section: ".$stuinfo[ $place{groupID} ].".".$linefeed;
                               } else {
                                   $$logmsg .= "Error when attempting section change for $uname from old section ".$$currlist{$uname}[$sec]." to new section: ".$stuinfo[ $place{groupID} ]." -error: $modify_section_result".$linefeed;
                               }
                         } else {                          } else {
                             $$logmsg .= "Error when attempting section change for $uname from old section ".$$currlist{$uname}[$sec]." to new section: ".$stuinfo[ $place{groupID} ]." -error: $modify_section_result".$linefeed;                              $$logmsg .= "Error when attempting to expire role for $uname in old section" .$$currlist{$uname}[$sec]." -error: $expire_role_result".$linefeed;
                         }                          }
                     }                      }
                 }                  }
Line 230  sub update_LC { Line 242  sub update_LC {
                     if ( ($authparam eq '')  || (!defined($authparam)) )  {                      if ( ($authparam eq '')  || (!defined($authparam)) )  {
                         $authparam = $autharg;                          $authparam = $autharg;
                     }                      }
                     if ($auth =~ m/^krb/) {  
                         $auth .= ":".$authparam;  
                     }  
                     if ( ($end eq '') || (!defined($end)) )  {                      if ( ($end eq '') || (!defined($end)) )  {
                          $end = $enddate;                           $end = $enddate;
                     }                      }
Line 251  sub update_LC { Line 260  sub update_LC {
                         my $authchk = '';                          my $authchk = '';
                         unless ($authparam eq '') { $authchk = 'ok'; };                          unless ($authparam eq '') { $authchk = 'ok'; };
 # If no account exists and passwords should be generated  # If no account exists and passwords should be generated
                         if ($authtype eq "int") {                          if ($auth eq "internal") {
                             if ($authparam eq '') {                              if ($authparam eq '') {
                                 ($authparam) = &create_password();                                  ($authparam) = &create_password();
                                 if ($authparam eq '') {                                  if ($authparam eq '') {
                                      $authchk = '';                                      $authchk = '';
                                 } else {                                  } else {
                                     $create_passwd = 1;                                      $create_passwd = 1;
                                       $authchk = 'ok';
                                 }                                          }        
                             }                              }
                         } elsif ($authtype eq "local") {                          } elsif ($auth eq "localauth") {
                              ($authparam,$create_passwd,$authchk) = &localenroll::create_password($authparam);                              ($authparam,$create_passwd,$authchk) = &localenroll::create_password($authparam);
                         } elsif ($authtype =~ m/^krb/) {                          } elsif ($auth =~ m/^krb/) {
                             if ($authparam eq '') {                              if ($authparam eq '') {
                                 $$logmsg .= "No Kerberos domain was provided for the new user - $uname, so the new student was not enrolled in the course.".$linefeed;                                  $$logmsg .= "No Kerberos domain was provided for the new user - $uname, so the new student was not enrolled in the course.".$linefeed;
                                 $authchk = 'invalid';                                  $authchk = 'invalid';
Line 329  sub update_LC { Line 339  sub update_LC {
                         }                                                      }                            
                         my $krbdefdom = '';                          my $krbdefdom = '';
                         my $currentauth=&Apache::lonnet::queryauthenticate($uname,$dom);                          my $currentauth=&Apache::lonnet::queryauthenticate($uname,$dom);
                         if ($currentauth=~/^krb(4|5):/) {                          if ($currentauth=~/^(krb[45]):(.*)/) {
                             $currentauth=~/^krb(4|5):(.*)/;                              $currentauth = $1;
                             $krbdefdom=$1;                              $krbdefdom = $2;
                         }                          } elsif ($currentauth=~ /^(unix|internal|localauth):/) {
                         if ($currentauth=~/^krb(4|5):/ ||                               $currentauth = $1;
                             $currentauth=~/^unix:/ ||  
                             $currentauth=~/^internal:/ ||  
                             $currentauth=~/^localauth:/) {  
                                  
                         } else {                          } else {
                             $$logmsg .= "Invalid authentication method $currentauth for $uname.".$linefeed;                                $$logmsg .= "Invalid authentication method $currentauth for $uname.".$linefeed;  
                         }                          }
 # Report if authentication methods are different.  # Report if authentication methods are different.
                         if ($currentauth ne $auth ) {                          if ($currentauth ne $auth) {
                             $$logmsg .= "Authentication mismatch for $uname - $currentauth in system, $auth based on information in classlist or default for this course.".$linefeed;                              $$logmsg .= "Authentication type mismatch for $uname - '$currentauth' in system, '$auth' based on information in classlist or default for this course.".$linefeed;
                         }                          } elsif ($auth =~ m/^krb/) {
                               if ($krbdefdom ne $authparam) {
                                   $$logmsg .= "Kerberos domain mismatch for $uname - '$krbdefdom' in system, '$authparam' based on information in classlist or default for this course.".$linefeed;
                               }
   
 # Check user data  # Check user data
                         if ($first  ne $userenv{'firstname'}  ||                          if ($first  ne $userenv{'firstname'}  ||
                             $middle ne $userenv{'middlename'} ||                              $middle ne $userenv{'middlename'} ||
Line 527  sub process_date { Line 537  sub process_date {
   
 sub create_password {  sub create_password {
     my $passwd = '';      my $passwd = '';
     my @letts = "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z";      my @letts = ("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
     for (my $i=0; $i<8; $i++) {      for (my $i=0; $i<8; $i++) {
         my $lettnum = int (rand 2);          my $lettnum = int (rand 2);
         my $item = '';          my $item = '';

Removed from v.1.9  
changed lines
  Added in v.1.12


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