Lines 718-724
sub checkauth {
Link Here
|
718 |
$userid = $retuserid; |
718 |
$userid = $retuserid; |
719 |
$info{'invalidCasLogin'} = 1 unless ($return); |
719 |
$info{'invalidCasLogin'} = 1 unless ($return); |
720 |
} else { |
720 |
} else { |
721 |
( $return, $cardnumber ) = checkpw( $dbh, $userid, $password, $query ); |
721 |
my $retuserid; |
|
|
722 |
( $return, $retuserid ) = checkpw( $dbh, $userid, $password, $query ); |
723 |
$userid = $retuserid if ($retuserid ne ''); |
722 |
} |
724 |
} |
723 |
if ($return) { |
725 |
if ($return) { |
724 |
_session_log(sprintf "%20s from %16s logged in at %30s.\n", $userid,$ENV{'REMOTE_ADDR'},(strftime '%c', localtime)); |
726 |
_session_log(sprintf "%20s from %16s logged in at %30s.\n", $userid,$ENV{'REMOTE_ADDR'},(strftime '%c', localtime)); |
Lines 744-763
sub checkauth {
Link Here
|
744 |
"; |
746 |
"; |
745 |
my $sth = $dbh->prepare("$select where userid=?"); |
747 |
my $sth = $dbh->prepare("$select where userid=?"); |
746 |
$sth->execute($userid); |
748 |
$sth->execute($userid); |
747 |
unless ($sth->rows) { |
749 |
unless ($sth->rows) { |
748 |
$debug and print STDERR "AUTH_1: no rows for userid='$userid'\n"; |
750 |
$debug and print STDERR "AUTH_1: no rows for userid='$userid'\n"; |
749 |
$sth = $dbh->prepare("$select where cardnumber=?"); |
751 |
$sth = $dbh->prepare("$select where cardnumber=?"); |
750 |
$sth->execute($cardnumber); |
752 |
$sth->execute($cardnumber); |
751 |
unless ($sth->rows) { |
753 |
|
752 |
$debug and print STDERR "AUTH_2a: no rows for cardnumber='$cardnumber'\n"; |
754 |
unless ($sth->rows) { |
753 |
$sth->execute($userid); |
755 |
$debug and print STDERR "AUTH_2a: no rows for cardnumber='$cardnumber'\n"; |
754 |
unless ($sth->rows) { |
756 |
$sth->execute($userid); |
755 |
$debug and print STDERR "AUTH_2b: no rows for userid='$userid' AS cardnumber\n"; |
757 |
unless ($sth->rows) { |
756 |
} |
758 |
$debug and print STDERR "AUTH_2b: no rows for userid='$userid' AS cardnumber\n"; |
757 |
} |
759 |
} |
758 |
} |
760 |
} |
|
|
761 |
} |
759 |
if ($sth->rows) { |
762 |
if ($sth->rows) { |
760 |
($borrowernumber, $firstname, $surname, $userflags, |
763 |
($borrowernumber, $firstname, $surname, $userflags, |
761 |
$branchcode, $branchname, $branchprinter, $emailaddress) = $sth->fetchrow; |
764 |
$branchcode, $branchname, $branchprinter, $emailaddress) = $sth->fetchrow; |
762 |
$debug and print STDERR "AUTH_3 results: " . |
765 |
$debug and print STDERR "AUTH_3 results: " . |
763 |
"$cardnumber,$borrowernumber,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress\n"; |
766 |
"$cardnumber,$borrowernumber,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress\n"; |
Lines 1383-1389
sub checkpw {
Link Here
|
1383 |
|
1386 |
|
1384 |
C4::Context->set_userenv( "$borrowernumber", $userid, $cardnumber, |
1387 |
C4::Context->set_userenv( "$borrowernumber", $userid, $cardnumber, |
1385 |
$firstname, $surname, $branchcode, $flags ); |
1388 |
$firstname, $surname, $branchcode, $flags ); |
1386 |
return 1, $cardnumber; |
1389 |
return 1, $userid; |
1387 |
} |
1390 |
} |
1388 |
} |
1391 |
} |
1389 |
$sth = |
1392 |
$sth = |
Lines 1547-1553
sub haspermission {
Link Here
|
1547 |
my ($userid, $flagsrequired) = @_; |
1550 |
my ($userid, $flagsrequired) = @_; |
1548 |
my $sth = C4::Context->dbh->prepare("SELECT flags FROM borrowers WHERE userid=?"); |
1551 |
my $sth = C4::Context->dbh->prepare("SELECT flags FROM borrowers WHERE userid=?"); |
1549 |
$sth->execute($userid); |
1552 |
$sth->execute($userid); |
1550 |
my $flags = getuserflags( $sth->fetchrow(), $userid ); |
1553 |
my $flags = getuserflags($sth->fetchrow(), $userid); |
1551 |
if ( $userid eq C4::Context->config('user') ) { |
1554 |
if ( $userid eq C4::Context->config('user') ) { |
1552 |
# Super User Account from /etc/koha.conf |
1555 |
# Super User Account from /etc/koha.conf |
1553 |
$flags->{'superlibrarian'} = 1; |
1556 |
$flags->{'superlibrarian'} = 1; |
Lines 1556-1562
sub haspermission {
Link Here
|
1556 |
# Demo user that can do "anything" (demo=1 in /etc/koha.conf) |
1559 |
# Demo user that can do "anything" (demo=1 in /etc/koha.conf) |
1557 |
$flags->{'superlibrarian'} = 1; |
1560 |
$flags->{'superlibrarian'} = 1; |
1558 |
} |
1561 |
} |
|
|
1562 |
|
1559 |
return $flags if $flags->{superlibrarian}; |
1563 |
return $flags if $flags->{superlibrarian}; |
|
|
1564 |
|
1560 |
foreach my $module ( keys %$flagsrequired ) { |
1565 |
foreach my $module ( keys %$flagsrequired ) { |
1561 |
my $subperm = $flagsrequired->{$module}; |
1566 |
my $subperm = $flagsrequired->{$module}; |
1562 |
if ($subperm eq '*') { |
1567 |
if ($subperm eq '*') { |
1563 |
- |
|
|