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

(-)a/Koha/Script.pm (-2 / +2 lines)
Lines 47-53 sub import { Link Here
47
        # Set userenv
47
        # Set userenv
48
        C4::Context->_new_userenv(1);
48
        C4::Context->_new_userenv(1);
49
        C4::Context->set_userenv(
49
        C4::Context->set_userenv(
50
            undef, undef, undef, 'CRON', 'CRON', undef,
50
            undef, undef, undef, 'CRON', 'CRON',
51
            undef, undef, undef, undef,  undef
51
            undef, undef, undef, undef,  undef
52
        );
52
        );
53
53
Lines 58-64 sub import { Link Here
58
    else {
58
    else {
59
        # Set userenv
59
        # Set userenv
60
        C4::Context->set_userenv(
60
        C4::Context->set_userenv(
61
            undef, undef, undef, 'CLI', 'CLI', undef,
61
            undef, undef, undef, 'CLI', 'CLI',
62
            undef, undef, undef, undef,  undef
62
            undef, undef, undef, undef,  undef
63
        );
63
        );
64
64
(-)a/misc/commit_file.pl (-1 / +1 lines)
Lines 41-47 if ($list_batches) { Link Here
41
41
42
# FIXME dummy user so that logging won't fail
42
# FIXME dummy user so that logging won't fail
43
# in future, probably should tie to a real user account
43
# in future, probably should tie to a real user account
44
C4::Context->set_userenv(0, 'batch', 0, 'batch', 'batch', 'batch', 'batch', 'batch');
44
C4::Context->set_userenv(0, 'batch', 0, 'batch', 'batch', 'batch', 'batch');
45
45
46
my $dbh = C4::Context->dbh;
46
my $dbh = C4::Context->dbh;
47
$dbh->{AutoCommit} = 0;
47
$dbh->{AutoCommit} = 0;
(-)a/t/Token.t (-5 / +3 lines)
Lines 27-33 use C4::Context; Link Here
27
use Koha::Token;
27
use Koha::Token;
28
28
29
C4::Context->_new_userenv('DUMMY SESSION');
29
C4::Context->_new_userenv('DUMMY SESSION');
30
C4::Context->set_userenv(0,42,0,'firstname','surname', 'CPL', 'Library 1', 0, ', ');
30
C4::Context->set_userenv(0,42,0,'firstname','surname', 'CPL', 'Library 1', 0, '');
31
31
32
my $tokenizer = Koha::Token->new;
32
my $tokenizer = Koha::Token->new;
33
is( length( $tokenizer->generate ), 1, "Generate without parameters" );
33
is( length( $tokenizer->generate ), 1, "Generate without parameters" );
Lines 67-74 subtest 'Same id (cookie CGISESSID) with an other logged in user' => sub { Link Here
67
    $result = $tokenizer->check_csrf({
67
    $result = $tokenizer->check_csrf({
68
        session_id => $id, token => $csrftoken,
68
        session_id => $id, token => $csrftoken,
69
    });
69
    });
70
    is( $result, 1, "CSRF token verified" );
70
    C4::Context->set_userenv(0,43,0,'firstname','surname', 'CPL', 'Library 1', 0, '');
71
    C4::Context->set_userenv(0,43,0,'firstname','surname', 'CPL', 'Library 1', 0, ', ');
72
    $result = $tokenizer->check_csrf({
71
    $result = $tokenizer->check_csrf({
73
        session_id => $id, token => $csrftoken,
72
        session_id => $id, token => $csrftoken,
74
    });
73
    });
Lines 77-83 subtest 'Same id (cookie CGISESSID) with an other logged in user' => sub { Link Here
77
76
78
subtest 'Same logged in user with another session (cookie CGISESSID)' => sub {
77
subtest 'Same logged in user with another session (cookie CGISESSID)' => sub {
79
    plan tests => 2;
78
    plan tests => 2;
80
    C4::Context->set_userenv(0,42,0,'firstname','surname', 'CPL', 'Library 1', 0, ', ');
79
    C4::Context->set_userenv(0,42,0,'firstname','surname', 'CPL', 'Library 1', 0, '');
81
    $csrftoken = $tokenizer->generate_csrf({ session_id => $id });
80
    $csrftoken = $tokenizer->generate_csrf({ session_id => $id });
82
    $result = $tokenizer->check_csrf({
81
    $result = $tokenizer->check_csrf({
83
        session_id => $id, token => $csrftoken,
82
        session_id => $id, token => $csrftoken,
84
- 

Return to bug 17845