Bug 20479: Ease readability - do not enter the block if not logged in
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 27 Mar 2018 16:37:35 +0000 (13:37 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 27 Mar 2018 16:39:21 +0000 (13:39 -0300)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/Auth.pm

index 3f1c9dd..13c4652 100644 (file)
@@ -179,14 +179,13 @@ sub get_template_and_user {
         );
     }
 
-    if ( $in->{type} eq 'opac' ) {
+    if ( $in->{type} eq 'opac' && $user ) {
         my $kick_out;
 
         if (
 # 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
                $in->{template_name} !~ m|sco/|
-            && $user
             && C4::Context->preference('AutoSelfCheckID')
             && $user eq C4::Context->preference('AutoSelfCheckID')
           )
@@ -198,7 +197,6 @@ sub get_template_and_user {
 # kick them out unless it is SCO with a valid permission
 # or they are a superlibrarian
                $in->{template_name} !~ m|sci/|
-            && $user
             && haspermission( $user, { self_check => 'self_checkin_module' } )
             && !(
                 $in->{template_name} =~ m|sco/| && haspermission(