Bug 7976: Remove the borrow permission
[koha.git] / C4 / InstallAuth.pm
index 35ac2e1..c1eba6a 100644 (file)
@@ -4,18 +4,18 @@ package C4::InstallAuth;
 #
 # This file is part of Koha.
 #
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
 #
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use strict;
 #use warnings; FIXME - Bug 2505
@@ -39,19 +39,20 @@ InstallAuth - Authenticates Koha users for Install process
 
 =head1 SYNOPSIS
 
-  use CGI;
+  use CGI qw ( -utf8 );
   use InstallAuth;
   use C4::Output;
 
   my $query = new CGI;
 
-  my ($template, $borrowernumber, $cookie) 
-    = get_template_and_user({template_name   => "opac-main.tt",
-                             query           => $query,
-                            type            => "opac",
-                            authnotrequired => 1,
-                            flagsrequired   => {borrow => 1},
-                         });
+    my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
+        {   template_name   => "opac-main.tt",
+            query           => $query,
+            type            => "opac",
+            authnotrequired => 1,
+            flagsrequired   => { acquisition => '*' },
+        }
+    );
 
   output_html_with_http_headers $query, $cookie, $template->output;
 
@@ -80,13 +81,14 @@ InstallAuth - Authenticates Koha users for Install process
 
 =item get_template_and_user
 
-  my ($template, $borrowernumber, $cookie)
-    = get_template_and_user({template_name   => "opac-main.tt",
-                             query           => $query,
-                            type            => "opac",
-                            authnotrequired => 1,
-                            flagsrequired   => {borrow => 1},
-                         });
+    my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
+        {   template_name   => "opac-main.tt",
+            query           => $query,
+            type            => "opac",
+            authnotrequired => 1,
+            flagsrequired   => { acquisition => '*' },
+        }
+    );
 
     This call passes the C<query>, C<flagsrequired> and C<authnotrequired>
     to C<&checkauth> (in this module) to perform authentification.
@@ -139,7 +141,6 @@ sub get_template_and_user {
             $template->param( CAN_user_borrowers        => 1 );
             $template->param( CAN_user_permission       => 1 );
             $template->param( CAN_user_reserveforothers => 1 );
-            $template->param( CAN_user_borrow           => 1 );
             $template->param( CAN_user_editcatalogue    => 1 );
             $template->param( CAN_user_updatecharges    => 1 );
             $template->param( CAN_user_acquisition      => 1 );
@@ -246,7 +247,7 @@ sub checkauth {
           new CGI::Session( "driver:File;serializer:yaml", $sessionID,
             { Directory => '/tmp' } );
         if ( $session->param('cardnumber') ) {
-            C4::Context::set_userenv(
+            C4::Context->set_userenv(
                 $session->param('number'),
                 $session->param('id'),
                 $session->param('cardnumber'),
@@ -308,7 +309,7 @@ sub checkauth {
            #Only superlibrarian should have access to this page.
            #Since if it is a user, it is supposed that there is a borrower table
            #And thus that data structure is loaded.
-                my $hash = C4::Context::set_userenv(
+                my $hash = C4::Context->set_userenv(
                     0,                           0,
                     C4::Context->config('user'), C4::Context->config('user'),
                     C4::Context->config('user'), "",
@@ -412,7 +413,7 @@ sub checkpw {
             C4::Context->config('user'),
             C4::Context->config('user'),
             C4::Context->config('user'),
-            "", 1
+            "", "NO_LIBRARY_SET", 1
         );
         return 2;
     }