Lines 736-742
sub checkauth {
Link Here
|
736 |
$userid = $retuserid; |
736 |
$userid = $retuserid; |
737 |
$info{'invalidCasLogin'} = 1 unless ($return); |
737 |
$info{'invalidCasLogin'} = 1 unless ($return); |
738 |
} else { |
738 |
} else { |
739 |
( $return, $cardnumber ) = checkpw( $dbh, $userid, $password, $query ); |
739 |
my $retuserid; |
|
|
740 |
( $return, $retuserid ) = checkpw( $dbh, $userid, $password, $query ); |
741 |
$userid = $retuserid if ($retuserid ne ''); |
740 |
} |
742 |
} |
741 |
if ($return) { |
743 |
if ($return) { |
742 |
_session_log(sprintf "%20s from %16s logged in at %30s.\n", $userid,$ENV{'REMOTE_ADDR'},(strftime '%c', localtime)); |
744 |
_session_log(sprintf "%20s from %16s logged in at %30s.\n", $userid,$ENV{'REMOTE_ADDR'},(strftime '%c', localtime)); |
Lines 762-781
sub checkauth {
Link Here
|
762 |
"; |
764 |
"; |
763 |
my $sth = $dbh->prepare("$select where userid=?"); |
765 |
my $sth = $dbh->prepare("$select where userid=?"); |
764 |
$sth->execute($userid); |
766 |
$sth->execute($userid); |
765 |
unless ($sth->rows) { |
767 |
unless ($sth->rows) { |
766 |
$debug and print STDERR "AUTH_1: no rows for userid='$userid'\n"; |
768 |
$debug and print STDERR "AUTH_1: no rows for userid='$userid'\n"; |
767 |
$sth = $dbh->prepare("$select where cardnumber=?"); |
769 |
$sth = $dbh->prepare("$select where cardnumber=?"); |
768 |
$sth->execute($cardnumber); |
770 |
$sth->execute($cardnumber); |
769 |
unless ($sth->rows) { |
771 |
|
770 |
$debug and print STDERR "AUTH_2a: no rows for cardnumber='$cardnumber'\n"; |
772 |
unless ($sth->rows) { |
771 |
$sth->execute($userid); |
773 |
$debug and print STDERR "AUTH_2a: no rows for cardnumber='$cardnumber'\n"; |
772 |
unless ($sth->rows) { |
774 |
$sth->execute($userid); |
773 |
$debug and print STDERR "AUTH_2b: no rows for userid='$userid' AS cardnumber\n"; |
775 |
unless ($sth->rows) { |
774 |
} |
776 |
$debug and print STDERR "AUTH_2b: no rows for userid='$userid' AS cardnumber\n"; |
775 |
} |
777 |
} |
776 |
} |
778 |
} |
|
|
779 |
} |
777 |
if ($sth->rows) { |
780 |
if ($sth->rows) { |
778 |
($borrowernumber, $firstname, $surname, $userflags, |
781 |
($borrowernumber, $firstname, $surname, $userflags, |
779 |
$branchcode, $branchname, $branchprinter, $emailaddress) = $sth->fetchrow; |
782 |
$branchcode, $branchname, $branchprinter, $emailaddress) = $sth->fetchrow; |
780 |
$debug and print STDERR "AUTH_3 results: " . |
783 |
$debug and print STDERR "AUTH_3 results: " . |
781 |
"$cardnumber,$borrowernumber,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress\n"; |
784 |
"$cardnumber,$borrowernumber,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress\n"; |
Lines 1413-1419
sub checkpw {
Link Here
|
1413 |
|
1416 |
|
1414 |
C4::Context->set_userenv( "$borrowernumber", $userid, $cardnumber, |
1417 |
C4::Context->set_userenv( "$borrowernumber", $userid, $cardnumber, |
1415 |
$firstname, $surname, $branchcode, $flags ); |
1418 |
$firstname, $surname, $branchcode, $flags ); |
1416 |
return 1, $cardnumber; |
1419 |
return 1, $userid; |
1417 |
} |
1420 |
} |
1418 |
} |
1421 |
} |
1419 |
$sth = |
1422 |
$sth = |
Lines 1577-1583
sub haspermission {
Link Here
|
1577 |
my ($userid, $flagsrequired) = @_; |
1580 |
my ($userid, $flagsrequired) = @_; |
1578 |
my $sth = C4::Context->dbh->prepare("SELECT flags FROM borrowers WHERE userid=?"); |
1581 |
my $sth = C4::Context->dbh->prepare("SELECT flags FROM borrowers WHERE userid=?"); |
1579 |
$sth->execute($userid); |
1582 |
$sth->execute($userid); |
1580 |
my $flags = getuserflags( $sth->fetchrow(), $userid ); |
1583 |
my $flags = getuserflags($sth->fetchrow(), $userid); |
1581 |
if ( $userid eq C4::Context->config('user') ) { |
1584 |
if ( $userid eq C4::Context->config('user') ) { |
1582 |
# Super User Account from /etc/koha.conf |
1585 |
# Super User Account from /etc/koha.conf |
1583 |
$flags->{'superlibrarian'} = 1; |
1586 |
$flags->{'superlibrarian'} = 1; |
Lines 1586-1592
sub haspermission {
Link Here
|
1586 |
# Demo user that can do "anything" (demo=1 in /etc/koha.conf) |
1589 |
# Demo user that can do "anything" (demo=1 in /etc/koha.conf) |
1587 |
$flags->{'superlibrarian'} = 1; |
1590 |
$flags->{'superlibrarian'} = 1; |
1588 |
} |
1591 |
} |
|
|
1592 |
|
1589 |
return $flags if $flags->{superlibrarian}; |
1593 |
return $flags if $flags->{superlibrarian}; |
|
|
1594 |
|
1590 |
foreach my $module ( keys %$flagsrequired ) { |
1595 |
foreach my $module ( keys %$flagsrequired ) { |
1591 |
my $subperm = $flagsrequired->{$module}; |
1596 |
my $subperm = $flagsrequired->{$module}; |
1592 |
if ($subperm eq '*') { |
1597 |
if ($subperm eq '*') { |
1593 |
- |
|
|