[LON-CAPA-cvs] cvs: loncom /enrollment Enrollment.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Thu, 18 Mar 2004 00:24:57 -0000


raeburn		Wed Mar 17 19:24:57 2004 EDT

  Modified files:              
    /loncom/enrollment	Enrollment.pm 
  Log:
  Bug fixes (6) for support of local and internal authentication. tabination changes (2) and style changes (1). Recommended for 1.1.3
  
  
Index: loncom/enrollment/Enrollment.pm
diff -u loncom/enrollment/Enrollment.pm:1.10 loncom/enrollment/Enrollment.pm:1.11
--- loncom/enrollment/Enrollment.pm:1.10	Wed Jan 14 16:03:31 2004
+++ loncom/enrollment/Enrollment.pm	Wed Mar 17 19:24:57 2004
@@ -1,5 +1,5 @@
 # Automated Enrollment manager
-# $Id: Enrollment.pm,v 1.10 2004/01/14 21:03:31 raeburn Exp $
+# $Id: Enrollment.pm,v 1.11 2004/03/18 00:24:57 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -243,7 +243,7 @@
                         $authparam = $autharg;
                     }
                     if ($auth =~ m/^krb/) {
-                        $auth .= ":".$authparam;
+                        $auth .= ':'.$authparam;
                     }
                     if ( ($end eq '') || (!defined($end)) )  {
                          $end = $enddate;
@@ -263,18 +263,19 @@
                         my $authchk = '';
                         unless ($authparam eq '') { $authchk = 'ok'; };
 # If no account exists and passwords should be generated
-                        if ($authtype eq "int") {
+                        if ($auth eq "internal") {
                             if ($authparam eq '') {
                                 ($authparam) = &create_password();
                                 if ($authparam eq '') {
-                                     $authchk = '';
+                                    $authchk = '';
                                 } else {
                                     $create_passwd = 1;
+                                    $authchk = 'ok';
                                 }        
                             }
-                        } elsif ($authtype eq "local") {
-                             ($authparam,$create_passwd,$authchk) = &localenroll::create_password($authparam);
-                        } elsif ($authtype =~ m/^krb/) {
+                        } elsif ($auth eq "localauth") {
+                            ($authparam,$create_passwd,$authchk) = &localenroll::create_password($authparam);
+                        } elsif ($auth =~ m/^krb/) {
                             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;
                                 $authchk = 'invalid';
@@ -344,12 +345,8 @@
                         if ($currentauth=~/^krb(4|5):/) {
                             $currentauth=~/^krb(4|5):(.*)/;
                             $krbdefdom=$1;
-                        }
-                        if ($currentauth=~/^krb(4|5):/ || 
-                            $currentauth=~/^unix:/ ||
-                            $currentauth=~/^internal:/ ||
-                            $currentauth=~/^localauth:/) {
-                               
+                        } elsif ($currentauth=~ /^(unix|internal|localauth):/) {
+                            $currentauth = $1;
                         } else {
                             $$logmsg .= "Invalid authentication method $currentauth for $uname.".$linefeed;  
                         }
@@ -539,7 +536,7 @@
 
 sub create_password {
     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++) {
         my $lettnum = int (rand 2);
         my $item = '';