[Koha-cvs] koha/C4 Auth.pm Context.pm [rel_3_0]

paul poulain paul at koha-fr.org
Wed Dec 20 17:50:48 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	paul poulain <tipaul>	06/12/20 16:50:48

Modified files:
	C4             : Auth.pm Context.pm 

Log message:
	improving "insecure" management
	
	WARNING KADOS :
	you told me that you had some libraries with insecure=ON (behind a firewall).
	In this commit, I created a "fake" user when insecure=ON. It has a fake branch. You may find better to have the 1st branch in branch table instead of a fake one.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Auth.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.54.2.17&r2=1.54.2.18
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Context.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.43.2.8&r2=1.43.2.9

Patches:
Index: Auth.pm
===================================================================
RCS file: /sources/koha/koha/C4/Auth.pm,v
retrieving revision 1.54.2.17
retrieving revision 1.54.2.18
diff -u -b -r1.54.2.17 -r1.54.2.18
--- Auth.pm	14 Dec 2006 15:41:53 -0000	1.54.2.17
+++ Auth.pm	20 Dec 2006 16:50:48 -0000	1.54.2.18
@@ -37,7 +37,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.54.2.17 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.54.2.18 $' =~ /\d+/g;
     shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v );
 };
 
@@ -123,7 +123,8 @@
     );
 
     my $borrowernumber;
-    if ($user) {
+    my $insecure = C4::Context->preference('insecure');
+    if ($user or $insecure) {
         $template->param( loggedinusername => $user );
         $template->param( sessionID        => $sessionID );
 
@@ -137,7 +138,7 @@
         # We are going to use the $flags returned by checkauth
         # to create the template's parameters that will indicate
         # which menus the user can access.
-        if ( $flags && $flags->{superlibrarian} == 1 ) {
+        if (( $flags && $flags->{superlibrarian} == 1) or $insecure) {
             $template->param( CAN_user_circulate        => 1 );
             $template->param( CAN_user_catalogue        => 1 );
             $template->param( CAN_user_parameters       => 1 );
@@ -228,7 +229,7 @@
             TemplateEncoding   => C4::Context->preference("TemplateEncoding"),
             AmazonContent      => C4::Context->preference("AmazonContent"),
             LibraryName        => C4::Context->preference("LibraryName"),
-            LoginBranchname         => C4::Context->userenv->{"branchname"},
+            LoginBranchname         => (C4::Context->userenv?C4::Context->userenv->{"branchname"}:"insecure"),
             AutoLocation       => C4::Context->preference("AutoLocation"),
         );
     }

Index: Context.pm
===================================================================
RCS file: /sources/koha/koha/C4/Context.pm,v
retrieving revision 1.43.2.8
retrieving revision 1.43.2.9
diff -u -b -r1.43.2.8 -r1.43.2.9
--- Context.pm	19 Dec 2006 16:48:16 -0000	1.43.2.8
+++ Context.pm	20 Dec 2006 16:50:48 -0000	1.43.2.9
@@ -16,7 +16,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Context.pm,v 1.43.2.8 2006/12/19 16:48:16 alaurin Exp $
+# $Id: Context.pm,v 1.43.2.9 2006/12/20 16:50:48 tipaul Exp $
 use strict;
 use DBI;
 use ZOOM;
@@ -28,7 +28,7 @@
     qw($context),
     qw(@context_stack);
 
-$VERSION = do { my @v = '$Revision: 1.43.2.8 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.43.2.9 $' =~ /\d+/g;
         shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 =head1 NAME
@@ -755,8 +755,20 @@
 {
     my $var = $context->{"activeuser"};
     return $context->{"userenv"}->{$var} if (defined $context->{"userenv"}->{$var});
+    # insecure=1 management
+    if ($context->preference('insecure')) {
+        my %insecure;
+        $insecure{flags} = '16382';
+        $insecure{branchname} ='Insecure',
+        $insecure{number} ='0';
+        $insecure{cardnumber} ='0';
+        $insecure{id} = 'insecure';
+        $insecure{branch} = 'INS';
+        $insecure{emailaddress} = 'test at mode.insecure.com';
+        return \%insecure;
+    } else {
     return 0;
-    warn "NO CONTEXT for $var";
+    }
 }
 
 =item set_userenv
@@ -857,6 +869,13 @@
 =cut
 
 # $Log: Context.pm,v $
+# Revision 1.43.2.9  2006/12/20 16:50:48  tipaul
+# improving "insecure" management
+#
+# WARNING KADOS :
+# you told me that you had some libraries with insecure=ON (behind a firewall).
+# In this commit, I created a "fake" user when insecure=ON. It has a fake branch. You may find better to have the 1st branch in branch table instead of a fake one.
+#
 # Revision 1.43.2.8  2006/12/19 16:48:16  alaurin
 # reident programs, and adding branchcode value in reserves2
 #





More information about the Koha-cvs mailing list