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

(-)a/C4/Auth.pm (-9 / +12 lines)
Lines 177-182 sub get_template_and_user { Link Here
177
177
178
    if ( $in->{'template_name'} !~ m/maintenance/ ) {
178
    if ( $in->{'template_name'} !~ m/maintenance/ ) {
179
        ( $user, $cookie, $sessionID, $flags ) = checkauth(
179
        ( $user, $cookie, $sessionID, $flags ) = checkauth(
180
180
            $in->{'query'},
181
            $in->{'query'},
181
            $in->{'authnotrequired'},
182
            $in->{'authnotrequired'},
182
            $in->{'flagsrequired'},
183
            $in->{'flagsrequired'},
Lines 204-214 sub get_template_and_user { Link Here
204
    }
205
    }
205
206
206
    if ( $in->{type} eq 'opac' && $user ) {
207
    if ( $in->{type} eq 'opac' && $user ) {
207
        my $is_sco_user;
208
        my $is_sc_user;
208
        if ($sessionID){
209
        if ($sessionID){
209
            my $session = get_session($sessionID);
210
            my $session = get_session($sessionID);
210
            if ($session){
211
            if ($session){
211
                $is_sco_user = $session->param('sco_user');
212
                $is_sc_user = $session->param('sco_user');
212
            }
213
            }
213
        }
214
        }
214
        my $kick_out;
215
        my $kick_out;
Lines 216-224 sub get_template_and_user { Link Here
216
        if (
217
        if (
217
# If the user logged in is the SCO user and they try to go out of the SCO module,
218
# If the user logged in is the SCO user and they try to go out of the SCO module,
218
# log the user out removing the CGISESSID cookie
219
# log the user out removing the CGISESSID cookie
219
            $in->{template_name} !~ m|sco/| && $in->{template_name} !~ m|errors/errorpage.tt|
220
            $in->{template_name} !~ m|sco/| && $in->{template_name} !~ m|sci/| && $in->{template_name} !~ m|errors/errorpage.tt|
220
            && (
221
            && (
221
                $is_sco_user ||
222
                $is_sc_user ||
222
                (
223
                (
223
                    C4::Context->preference('AutoSelfCheckID')
224
                    C4::Context->preference('AutoSelfCheckID')
224
                    && $user eq C4::Context->preference('AutoSelfCheckID')
225
                    && $user eq C4::Context->preference('AutoSelfCheckID')
Lines 1140-1145 sub checkauth { Link Here
1140
                    (
1141
                    (
1141
                        ( $type eq 'opac' )
1142
                        ( $type eq 'opac' )
1142
                        && C4::Context->preference('OPACShibOnly')
1143
                        && C4::Context->preference('OPACShibOnly')
1144
                        && !$query->param('sco_user_login')
1145
                        && !$query->param('sci_user_login')
1143
                    )
1146
                    )
1144
                    || ( ( $type ne 'opac' )
1147
                    || ( ( $type ne 'opac' )
1145
                        && C4::Context->preference('staffShibOnly') )
1148
                        && C4::Context->preference('staffShibOnly') )
Lines 1242-1252 sub checkauth { Link Here
1242
                        }
1245
                        }
1243
                    }
1246
                    }
1244
1247
1245
                    my $is_sco_user = 0;
1248
                    my $is_sc_user = 0;
1246
                    if ( $query->param('sco_user_login') && ( $query->param('sco_user_login') eq '1' ) ){
1249
                    if ( $query->param('sco_user_login') && ( $query->param('sco_user_login') eq '1' ) || ($query->param('sci_user_login') && ($query->param('sci_user_login') eq '1')) ){
1247
                        $is_sco_user = 1;
1250
                        $is_sc_user = 1;
1248
                    }
1251
                    }
1249
1252
1253
1250
                    $session->param( 'number',       $borrowernumber );
1254
                    $session->param( 'number',       $borrowernumber );
1251
                    $session->param( 'id',           $userid );
1255
                    $session->param( 'id',           $userid );
1252
                    $session->param( 'cardnumber',   $cardnumber );
1256
                    $session->param( 'cardnumber',   $cardnumber );
Lines 1264-1270 sub checkauth { Link Here
1264
                    $session->param( 'shibboleth',   $shibSuccess );
1268
                    $session->param( 'shibboleth',   $shibSuccess );
1265
                    $session->param( 'register_id',  $register_id );
1269
                    $session->param( 'register_id',  $register_id );
1266
                    $session->param( 'register_name',  $register_name );
1270
                    $session->param( 'register_name',  $register_name );
1267
                    $session->param( 'sco_user', $is_sco_user );
1271
                    $session->param( 'sco_user', $is_sc_user );
1268
                }
1272
                }
1269
                $session->param('cas_ticket', $cas_ticket) if $cas_ticket;
1273
                $session->param('cas_ticket', $cas_ticket) if $cas_ticket;
1270
                C4::Context->set_userenv(
1274
                C4::Context->set_userenv(
Lines 1346-1352 sub checkauth { Link Here
1346
            print $query->redirect(-uri => $uri->as_string, -cookie => $cookie, -status=>'303 See other');
1350
            print $query->redirect(-uri => $uri->as_string, -cookie => $cookie, -status=>'303 See other');
1347
            exit;
1351
            exit;
1348
        }
1352
        }
1349
1350
        return ( $userid, $cookie, $sessionID, $flags );
1353
        return ( $userid, $cookie, $sessionID, $flags );
1351
    }
1354
    }
1352
1355
(-)a/opac/sci/sci-main.pl (-4 / +12 lines)
Lines 29-43 use Try::Tiny qw( catch try ); Link Here
29
29
30
my $cgi = CGI->new;
30
my $cgi = CGI->new;
31
31
32
if (C4::Context->preference('AutoSelfCheckAllowed'))
33
{
34
        my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID');
35
        my $AutoSelfCheckPass = C4::Context->preference('AutoSelfCheckPass');
36
        $cgi->param(-name=>'userid',-values=>[$AutoSelfCheckID]);
37
        $cgi->param(-name=>'password',-values=>[$AutoSelfCheckPass]);
38
        $cgi->param(-name=>'koha_login_context',-values=>['sco']);
39
    }
40
41
# Let Auth know this is a SCI context
42
$cgi->param( -name => 'sci_user_login', -values => [1] );
43
32
# 404 if feature is disabled
44
# 404 if feature is disabled
33
unless ( C4::Context->preference('SelfCheckInModule') ) {
45
unless ( C4::Context->preference('SelfCheckInModule') ) {
34
    print $cgi->redirect("/cgi-bin/koha/errors/404.pl");
46
    print $cgi->redirect("/cgi-bin/koha/errors/404.pl");
35
    exit;
47
    exit;
36
}
48
}
37
49
38
# Let Auth know this is a SCI context
39
$cgi->param( -name => 'sci_user_login', -values => [1] );
40
41
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
50
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
42
    {
51
    {
43
        template_name   => "sci/sci-main.tt",
52
        template_name   => "sci/sci-main.tt",
44
- 

Return to bug 30590