Lines 179-218
sub get_template_and_user {
Link Here
|
179 |
); |
179 |
); |
180 |
} |
180 |
} |
181 |
|
181 |
|
|
|
182 |
if ( $in->{type} eq 'opac' ) { |
183 |
my $kick_out; |
182 |
|
184 |
|
183 |
# If the user logged in is the SCO user and they try to go out of the SCO module, log the user out removing the CGISESSID cookie |
185 |
if ( |
184 |
if ( $in->{type} eq 'opac' and $in->{template_name} !~ m|sco/| ) { |
186 |
# If the user logged in is the SCO user and they try to go out of the SCO module, |
185 |
if ( $user && C4::Context->preference('AutoSelfCheckID') && $user eq C4::Context->preference('AutoSelfCheckID') ) { |
187 |
# log the user out removing the CGISESSID cookie |
186 |
$template = C4::Templates::gettemplate( 'opac-auth.tt', 'opac', $in->{query} ); |
188 |
$in->{template_name} !~ m|sco/| |
187 |
my $cookie = $in->{query}->cookie( |
189 |
&& $user |
188 |
-name => 'CGISESSID', |
190 |
&& C4::Context->preference('AutoSelfCheckID') |
189 |
-value => '', |
191 |
&& $user eq C4::Context->preference('AutoSelfCheckID') |
190 |
-expires => '', |
192 |
) |
191 |
-HttpOnly => 1, |
193 |
{ |
192 |
); |
194 |
$kick_out = 1; |
193 |
|
195 |
} |
194 |
$template->param( |
196 |
elsif ( |
195 |
loginprompt => 1, |
197 |
# If the user logged in is the SCI user and they try to go out of the SCI module, |
196 |
script_name => get_script_name(), |
198 |
# kick them out unless it is SCO with a valid permission |
197 |
); |
199 |
$in->{template_name} !~ m|sci/| |
198 |
print $in->{query}->header( |
200 |
&& $user |
199 |
{ type => 'text/html', |
201 |
&& haspermission( $user, { self_check => 'self_checkin_module' } ) |
200 |
charset => 'utf-8', |
202 |
&& !( |
201 |
cookie => $cookie, |
203 |
$in->{template_name} =~ m|sco/| && haspermission( |
202 |
'X-Frame-Options' => 'SAMEORIGIN' |
204 |
$user, { self_check => 'self_checkout_module' } |
203 |
} |
205 |
) |
204 |
), |
206 |
) |
205 |
$template->output; |
207 |
) |
206 |
safe_exit; |
208 |
{ |
|
|
209 |
$kick_out = 1; |
207 |
} |
210 |
} |
208 |
} |
|
|
209 |
|
211 |
|
210 |
# If the user logged in is the SCI user and they try to go out of the SCI module, |
212 |
if ($kick_out) { |
211 |
# log the user out removing the CGISESSID cookie |
213 |
$template = C4::Templates::gettemplate( 'opac-auth.tt', 'opac', |
212 |
if ( $in->{type} eq 'opac' and $in->{template_name} !~ m|sci/| ) { |
214 |
$in->{query} ); |
213 |
if ( $user && C4::Context->preference('AutoSelfCheckID') && $user eq C4::Context->preference('AutoSelfCheckID') ) { |
215 |
$cookie = $in->{query}->cookie( |
214 |
$template = C4::Templates::gettemplate( 'opac-auth.tt', 'opac', $in->{query} ); |
|
|
215 |
my $cookie = $in->{query}->cookie( |
216 |
-name => 'CGISESSID', |
216 |
-name => 'CGISESSID', |
217 |
-value => '', |
217 |
-value => '', |
218 |
-expires => '', |
218 |
-expires => '', |
Lines 223-236
sub get_template_and_user {
Link Here
|
223 |
loginprompt => 1, |
223 |
loginprompt => 1, |
224 |
script_name => get_script_name(), |
224 |
script_name => get_script_name(), |
225 |
); |
225 |
); |
|
|
226 |
|
226 |
print $in->{query}->header( |
227 |
print $in->{query}->header( |
227 |
{ type => 'text/html', |
228 |
{ |
|
|
229 |
type => 'text/html', |
228 |
charset => 'utf-8', |
230 |
charset => 'utf-8', |
229 |
cookie => $cookie, |
231 |
cookie => $cookie, |
230 |
'X-Frame-Options' => 'SAMEORIGIN' |
232 |
'X-Frame-Options' => 'SAMEORIGIN' |
231 |
} |
233 |
} |
232 |
), |
234 |
), |
233 |
$template->output; |
235 |
$template->output; |
234 |
safe_exit; |
236 |
safe_exit; |
235 |
} |
237 |
} |
236 |
} |
238 |
} |