View | Details | Raw Unified | Return to bug 30444
Collapse All | Expand All

(-)a/C4/Auth.pm (-1 / +2 lines)
Lines 1038-1044 sub checkauth { Link Here
1038
            my ( $return, $cardnumber );
1038
            my ( $return, $cardnumber );
1039
1039
1040
            # If shib is enabled and we have a shib login, does the login match a valid koha user
1040
            # If shib is enabled and we have a shib login, does the login match a valid koha user
1041
            if ( $shib && $shib_login ) {
1041
            if ( $shib && $shib_login && !$query->param('userid')) {
1042
                my $retuserid;
1042
                my $retuserid;
1043
1043
1044
                # Do not pass password here, else shib will not be checked in checkpw.
1044
                # Do not pass password here, else shib will not be checked in checkpw.
Lines 1137-1142 sub checkauth { Link Here
1137
                    (
1137
                    (
1138
                        ( $type eq 'opac' )
1138
                        ( $type eq 'opac' )
1139
                        && C4::Context->preference('OPACShibOnly')
1139
                        && C4::Context->preference('OPACShibOnly')
1140
			&& C4::Context->preference('SelfCheckoutByLogin') ne 'shibboleth'
1140
                    )
1141
                    )
1141
                    || ( ( $type ne 'opac' )
1142
                    || ( ( $type ne 'opac' )
1142
                        && C4::Context->preference('staffShibOnly') )
1143
                        && C4::Context->preference('staffShibOnly') )
(-)a/installer/data/mysql/atomicupdate/bug_30444-edit_SelfCheckoutByLogin_syspref.pl (+18 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "30444",
5
    description => "Edit existing system preference SelfCheckoutByLogin",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        if ( C4::Context->preference('SelfCheckoutByLogin') ) {
11
            $dbh->do(q{ UPDATE systempreferences SET value="cardnumber" WHERE variable="SelfCheckoutByLogin" });
12
        } else {
13
            $dbh->do(q{ UPDATE systempreferences SET value="username" WHERE variable="SelfCheckoutByLogin" });
14
        }
15
16
        $dbh->do(q{ UPDATE systempreferences SET options="cardnumber|username|shibboleth", type="Choice", explanation="Have patrons log in to the web-based self checkout system with their username/password, their cardnumber, or using Shibboleth" WHERE variable="SelfCheckoutByLogin" });
17
    },
18
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 607-613 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
607
('SelfCheckInTimeout','120','','Define the number of seconds before the self check-in module times out.','Integer'),
607
('SelfCheckInTimeout','120','','Define the number of seconds before the self check-in module times out.','Integer'),
608
('SelfCheckInUserCSS','',NULL,'Add CSS to be included in the self check-in module in an embedded <style> tag.','free'),
608
('SelfCheckInUserCSS','',NULL,'Add CSS to be included in the self check-in module in an embedded <style> tag.','free'),
609
('SelfCheckInUserJS','',NULL,'Define custom javascript for inclusion in the self check-in module.','free'),
609
('SelfCheckInUserJS','',NULL,'Define custom javascript for inclusion in the self check-in module.','free'),
610
('SelfCheckoutByLogin','1',NULL,'Have patrons login into the web-based self checkout system with their username/password or their cardnumber','YesNo'),
610
('SelfCheckoutByLogin','username','username|cardnumber|shibboleth','Have patrons log in to the web-based self checkout system with their username/password, their cardnumber, or using Shibboleth','Choice'),
611
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
611
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
612
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
612
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
613
('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free'),
613
('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-2 / +3 lines)
Lines 1116-1123 Circulation: Link Here
1116
            - Have patrons log into the web-based self checkout system with their
1116
            - Have patrons log into the web-based self checkout system with their
1117
            - pref: SelfCheckoutByLogin
1117
            - pref: SelfCheckoutByLogin
1118
              choices:
1118
              choices:
1119
                  1: username and password
1119
                  username: username and password
1120
                  0: cardnumber
1120
                  cardnumber: cardnumber
1121
                  shibboleth: Shibboleth login
1121
            - ".</br>NOTE: If using 'cardnumber' and AutoSelfCheckAllowed you should set SelfCheckAllowByIPRanges to prevent brute force attacks to gain patron information outside the library."
1122
            - ".</br>NOTE: If using 'cardnumber' and AutoSelfCheckAllowed you should set SelfCheckAllowByIPRanges to prevent brute force attacks to gain patron information outside the library."
1122
        -
1123
        -
1123
            - "Time out the current patron's web-based self checkout system login after"
1124
            - "Time out the current patron's web-based self checkout system login after"
(-)a/opac/sco/sco-main.pl (-4 / +21 lines)
Lines 33-38 use Modern::Perl; Link Here
33
use CGI qw ( -utf8 );
33
use CGI qw ( -utf8 );
34
34
35
use C4::Auth qw( in_iprange get_template_and_user checkpw );
35
use C4::Auth qw( in_iprange get_template_and_user checkpw );
36
use C4::Auth_with_shibboleth qw( shib_ok get_login_shib );
36
use C4::Circulation qw( barcodedecode AddReturn CanBookBeIssued AddIssue CanBookBeRenewed AddRenewal );
37
use C4::Circulation qw( barcodedecode AddReturn CanBookBeIssued AddIssue CanBookBeRenewed AddRenewal );
37
use C4::Reserves;
38
use C4::Reserves;
38
use C4::Output qw( output_html_with_http_headers );
39
use C4::Output qw( output_html_with_http_headers );
Lines 117-123 my $issuer = Koha::Patrons->find( $issuerid )->unblessed; Link Here
117
118
118
my $patronid = $jwt ? Koha::Token->new->decode_jwt({ token => $jwt }) : undef;
119
my $patronid = $jwt ? Koha::Token->new->decode_jwt({ token => $jwt }) : undef;
119
unless ( $patronid ) {
120
unless ( $patronid ) {
120
    if ( C4::Context->preference('SelfCheckoutByLogin') ) {
121
    if ( C4::Context->preference('SelfCheckoutByLogin') eq 'shibboleth' ) {
122
        # Do Shibboleth login
123
        my ($shib, $shib_login, $patron, $value, $shib_config, $match_point);
124
        $shib = C4::Context->config('useshibboleth') && shib_ok();
125
        $shib_login = $shib ? get_login_shib() : undef;
126
        $shib_config = C4::Context->config('shibboleth');
127
        $match_point = $shib_config->{matchpoint};
128
        $patron = Koha::Patrons->find({ $match_point => $shib_login }) if $shib_login;
129
        if ($patron) {
130
           $patronid = $patron->userid;
131
        } else {
132
          undef $patronid;
133
        }
134
    } elsif ( C4::Context->preference('SelfCheckoutByLogin') eq 'username' ) {
121
        my $dbh = C4::Context->dbh;
135
        my $dbh = C4::Context->dbh;
122
        ( undef, $patronid ) = checkpw( $dbh, $patronlogin, $patronpw );
136
        ( undef, $patronid ) = checkpw( $dbh, $patronlogin, $patronpw );
123
    }
137
    }
Lines 130-137 unless ( $patronid ) { Link Here
130
144
131
my $patron;
145
my $patron;
132
if ( $patronid ) {
146
if ( $patronid ) {
133
    Koha::Plugins->call( 'patron_barcode_transform', \$patronid );
147
    if ( C4::Context->preference('SelfCheckoutByLogin') eq 'shibboleth' ) {
134
    $patron = Koha::Patrons->find( { cardnumber => $patronid } );
148
        $patron = Koha::Patrons->find( { userid => $patronid } );
149
    } else {
150
        Koha::Plugins->call( 'patron_barcode_transform', \$patronid );
151
        $patron = Koha::Patrons->find( { cardnumber => $patronid } );
152
    }
135
}
153
}
136
154
137
undef $jwt unless $patron;
155
undef $jwt unless $patron;
138
- 

Return to bug 30444