koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/C4 Auth.pm,1.35,1.36


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/C4 Auth.pm,1.35,1.36
Date: Fri, 05 Nov 2004 02:12:29 -0800

Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11688/C4

Modified Files:
        Auth.pm 
Log Message:
remove LDAP dependancy, replaced by auth_with_ldap.pm

Index: Auth.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Auth.pm,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** Auth.pm     2 Sep 2004 16:25:20 -0000       1.35
--- Auth.pm     5 Nov 2004 10:12:27 -0000       1.36
***************
*** 29,34 ****
  use C4::Interface::CGI::Output;
  use C4::Circulation::Circ2;  # getpatroninformation
! use Net::LDAP;
! use Net::LDAP qw(:all);
  
  use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
--- 29,34 ----
  use C4::Interface::CGI::Output;
  use C4::Circulation::Circ2;  # getpatroninformation
! # use Net::LDAP;
! # use Net::LDAP qw(:all);
  
  use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
***************
*** 348,416 ****
  sub checkpw {
  
- # This should be modified to allow a selection of authentication schemes
- # (e.g. LDAP), as well as local authentication through the borrowers
- # tables passwd field
- #
        my ($dbh, $userid, $password) = @_;
- # LDAP
- #     my $sth=$dbh->prepare("select value from systempreferences where 
variable=?");
- #     $sth->execute("ldapserver");
-       my $ldapserver = C4::Context->preferences('ldapserver');
-       if ($ldapserver) {
-               my $ldapinfos = C4::Context->preferences('ldapinfos');
-               my %bindargs;
-               my $name  = "uid=$userid, $ldapinfos";
-               my $db = Net::LDAP->new( $ldapserver );
-               $bindargs{dn}=$name;
-               $bindargs{password}=$password;
-               my $res =$db->bind(%bindargs);
-               if($res->code) {
-               # auth refused
-                       return 0;
-               } else {
-                       #get the cardnumber
-                       my $sth=$dbh->prepare("select cardnumber from borrowers 
where userid=?");
-                       $sth->execute($userid);
-                       if ($sth->rows) {
-                               my $cardnumber = $sth->fetchrow;
-                               #we have the cardnumber
-                               return 1,$cardnumber;
-                       } else {
-                               # retrieve the LDAP informations & create the 
user
-                               my $borrower = $db->search(base => %bindargs,
-                                                       filter => 
"(sn=$userid)",
-                                                       );
-                                my $href = $borrower->as_struct;
-                               # get an array of the DN names
-                               my @arrayOfDNs  = keys %$href;        # use DN 
hashes
-                               # process each DN using it as a key
-                               my %borrower;
-                               foreach ( @arrayOfDNs ) {
-                                       print $_, "\n";
-                                       my $valref = $$href{$_};
-                                       # get an array of the attribute names
-                                       # passed for this one DN.
-                                       my @arrayOfAttrs = sort keys %$valref; 
#use Attr hashes
-                                       my $attrName;        
-                                       foreach $attrName (@arrayOfAttrs) {
-                                               # skip any binary data: yuck!
-                                               next if ( $attrName =~ 
/;binary$/ );
-                                               # get the attribute value 
(pointer) using the
-                                               # attribute name as the hash
-                                               my $attrVal =  
@$valref{$attrName};
-                                               print "\t $attrName: @$attrVal 
\n";
-                                               $borrower{$attrName}= @$attrVal;
-                                       }
-                               }
-                               # create the user in Koha DB
-                               newmember(%borrower);
-                               
-                       }
-                       if ($userid eq C4::Context->config('user') && $password 
eq C4::Context->config('pass')) {
-                               # Koha superuser account
-                               return 2;
-                       }
-               }
-       }
  # INTERNAL AUTH
        my $sth=$dbh->prepare("select password,cardnumber from borrowers where 
userid=?");
--- 348,352 ----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]