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

(-)a/installer/data/mysql/atomicupdate/bug_14407-add_selfcheckallowbyipranges_syspref.sql (+2 lines)
Line 0 Link Here
1
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES
2
	('SelfCheckAllowByIPRanges','',NULL,'(Leave blank if not used. Use ranges or simple ip addresses separated by spaces, like <code>192.168.1.1 192.168.0.0/24</code>.)','Short');
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 374-379 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
374
('SCOUserJS','',NULL,'Define custom javascript for inclusion in the SCO module','free'),
374
('SCOUserJS','',NULL,'Define custom javascript for inclusion in the SCO module','free'),
375
('SearchMyLibraryFirst','0',NULL,'If ON, OPAC searches return results limited by the user\'s library by default if they are logged in','YesNo'),
375
('SearchMyLibraryFirst','0',NULL,'If ON, OPAC searches return results limited by the user\'s library by default if they are logged in','YesNo'),
376
('SearchWithISBNVariations','0',NULL,'If enabled, search on all variations of the ISBN','YesNo'),
376
('SearchWithISBNVariations','0',NULL,'If enabled, search on all variations of the ISBN','YesNo'),
377
('SelfCheckAllowByIPRanges','',NULL,('Leave blank if not used. Use ranges or simple ip addresses separated by spaces, like <code>192.168.1.1 192.168.0.0/24</code>.)','Short'),
377
('SelfCheckHelpMessage','','70|10','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','Textarea'),
378
('SelfCheckHelpMessage','','70|10','Enter HTML to include under the basic Web-based Self Checkout instructions on the Help page','Textarea'),
378
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
379
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
379
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
380
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+4 lines)
Lines 681-686 Circulation: Link Here
681
                  yes: Show
681
                  yes: Show
682
                  no: "Don't show"
682
                  no: "Don't show"
683
            - "the print receipt popup dialog when self checkout is finished"
683
            - "the print receipt popup dialog when self checkout is finished"
684
        -
685
            - pref: SelfCheckAllowByIPRanges
686
              class: short
687
            - (Leave blank if not used. Use ranges or simple ip addresses separated by spaces, like <code>192.168.1.1 192.168.0.0/24</code>.)
684
688
685
    Course Reserves:
689
    Course Reserves:
686
        -
690
        -
(-)a/opac/sco/help.pl (+11 lines)
Lines 24-34 Link Here
24
use strict;
24
use strict;
25
use warnings;
25
use warnings;
26
use CGI qw ( -utf8 );
26
use CGI qw ( -utf8 );
27
use Net::CIDR;
27
28
28
use C4::Auth   qw(get_template_and_user);
29
use C4::Auth   qw(get_template_and_user);
29
use C4::Output qw(output_html_with_http_headers);
30
use C4::Output qw(output_html_with_http_headers);
30
31
31
my $query = new CGI;
32
my $query = new CGI;
33
34
35
my @allowedipranges = split(' ', C4::Context->preference('SelfCheckAllowByIPRanges'));
36
if (scalar @allowedipranges > 0) {
37
    unless (Net::CIDR::cidrlookup($ENV{'REMOTE_ADDR'}, Net::CIDR::range2cidr(@allowedipranges))) {
38
        print $query->redirect("/cgi-bin/koha/opac-main.pl");
39
        exit;
40
    }
41
}
42
32
my ($template, $borrowernumber, $cookie) = get_template_and_user({
43
my ($template, $borrowernumber, $cookie) = get_template_and_user({
33
    template_name => "sco/help.tt",
44
    template_name => "sco/help.tt",
34
    query => $query,
45
    query => $query,
(-)a/opac/sco/printslip.pl (+10 lines)
Lines 29-40 It is called from sco-main.pl Link Here
29
use strict;
29
use strict;
30
use warnings;
30
use warnings;
31
use CGI qw ( -utf8 );
31
use CGI qw ( -utf8 );
32
use Net::CIDR;
33
32
use C4::Context;
34
use C4::Context;
33
use C4::Auth qw/:DEFAULT get_session/;
35
use C4::Auth qw/:DEFAULT get_session/;
34
use C4::Output;
36
use C4::Output;
35
use C4::Members;
37
use C4::Members;
36
use C4::Koha;
38
use C4::Koha;
37
39
40
my @allowedipranges = split(' ', C4::Context->preference('SelfCheckAllowByIPRanges'));
41
if (scalar @allowedipranges > 0) {
42
    unless (Net::CIDR::cidrlookup($ENV{'REMOTE_ADDR'}, Net::CIDR::range2cidr(@allowedipranges))) {
43
        print $query->header(status => '403 Forbidden - functionality not available from your location');
44
        exit;
45
    }
46
}
47
38
my $input = new CGI;
48
my $input = new CGI;
39
my $sessionID = $input->cookie("CGISESSID");
49
my $sessionID = $input->cookie("CGISESSID");
40
my $session = get_session($sessionID);
50
my $session = get_session($sessionID);
(-)a/opac/sco/sco-main.pl (+9 lines)
Lines 36-41 use warnings; Link Here
36
36
37
use CGI qw ( -utf8 );
37
use CGI qw ( -utf8 );
38
use Digest::MD5 qw(md5_base64);
38
use Digest::MD5 qw(md5_base64);
39
use Net::CIDR;
39
40
40
use C4::Auth qw(get_template_and_user checkpw);
41
use C4::Auth qw(get_template_and_user checkpw);
41
use C4::Koha;
42
use C4::Koha;
Lines 54-59 unless (C4::Context->preference('WebBasedSelfCheck')) { Link Here
54
    exit;
55
    exit;
55
}
56
}
56
57
58
my @allowedipranges = split(' ', C4::Context->preference('SelfCheckAllowByIPRanges'));
59
if (scalar @allowedipranges > 0) {
60
    unless (Net::CIDR::cidrlookup($ENV{'REMOTE_ADDR'}, Net::CIDR::range2cidr(@allowedipranges))) {
61
        print $query->redirect("/cgi-bin/koha/opac-main.pl");
62
        exit;
63
    }
64
}
65
57
if (C4::Context->preference('AutoSelfCheckAllowed')) 
66
if (C4::Context->preference('AutoSelfCheckAllowed')) 
58
{
67
{
59
    my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID');
68
    my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID');
(-)a/opac/sco/sco-patron-image.pl (-1 / +9 lines)
Lines 19-24 Link Here
19
19
20
use strict;
20
use strict;
21
use warnings;
21
use warnings;
22
use Net::IP::Match::XS;
23
22
use C4::Service;
24
use C4::Service;
23
use C4::Members;
25
use C4::Members;
24
26
Lines 32-37 unless (C4::Context->preference('ShowPatronImageInWebBasedSelfCheck')) { Link Here
32
    print $query->header(status => '403 Forbidden - displaying patron images in self-check not enabled');
34
    print $query->header(status => '403 Forbidden - displaying patron images in self-check not enabled');
33
    exit;
35
    exit;
34
}
36
}
37
my @allowedipranges = split(' ', C4::Context->preference('SelfCheckAllowByIPRanges'));
38
if (scalar @allowedipranges > 0) {
39
    unless (Net::CIDR::cidrlookup($ENV{'REMOTE_ADDR'}, Net::CIDR::range2cidr(@allowedipranges))) {
40
        print $query->header(status => '403 Forbidden - functionality not available from your location');
41
        exit;
42
    }
43
}
35
44
36
my ($borrowernumber) = C4::Service->require_params('borrowernumber');
45
my ($borrowernumber) = C4::Service->require_params('borrowernumber');
37
46
38
- 

Return to bug 14407