Merge branch 'bug_9827' into 3.12-master

This commit is contained in:
Jared Camins-Esakov 2013-03-19 21:47:03 -04:00
commit 133a974649
11 changed files with 20 additions and 36 deletions

View File

@ -145,8 +145,7 @@ sub get_template_and_user {
}
my $borrowernumber;
my $insecure = C4::Context->preference('insecure');
if ($user or $insecure) {
if ($user) {
require C4::Members;
# It's possible for $user to be the borrowernumber if they don't have a
# userid defined (and are logging in through some other method, such
@ -186,7 +185,7 @@ sub get_template_and_user {
# 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) or $insecure==1) {
if ( $flags && $flags->{superlibrarian}==1 ) {
$template->param( CAN_user_circulate => 1 );
$template->param( CAN_user_catalogue => 1 );
$template->param( CAN_user_parameters => 1 );
@ -195,7 +194,7 @@ sub get_template_and_user {
$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_updatecharges => 1 );
$template->param( CAN_user_acquisition => 1 );
$template->param( CAN_user_management => 1 );
$template->param( CAN_user_tools => 1 );
@ -320,7 +319,7 @@ sub get_template_and_user {
GoogleJackets => C4::Context->preference("GoogleJackets"),
OpenLibraryCovers => C4::Context->preference("OpenLibraryCovers"),
KohaAdminEmailAddress => "" . C4::Context->preference("KohaAdminEmailAddress"),
LoginBranchcode => (C4::Context->userenv?C4::Context->userenv->{"branch"}:"insecure"),
LoginBranchcode => (C4::Context->userenv?C4::Context->userenv->{"branch"}:undef),
LoginFirstname => (C4::Context->userenv?C4::Context->userenv->{"firstname"}:"Bel"),
LoginSurname => C4::Context->userenv?C4::Context->userenv->{"surname"}:"Inconnu",
emailaddress => C4::Context->userenv?C4::Context->userenv->{"emailaddress"}:undef,
@ -349,7 +348,7 @@ sub get_template_and_user {
IntranetNav => C4::Context->preference("IntranetNav"),
IntranetmainUserblock => C4::Context->preference("IntranetmainUserblock"),
LibraryName => C4::Context->preference("LibraryName"),
LoginBranchname => (C4::Context->userenv?C4::Context->userenv->{"branchname"}:"insecure"),
LoginBranchname => (C4::Context->userenv?C4::Context->userenv->{"branchname"}:undef),
advancedMARCEditor => C4::Context->preference("advancedMARCEditor"),
canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'),
intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
@ -956,10 +955,9 @@ sub checkauth {
$session->param('sessiontype','anon');
}
} # END unless ($userid)
my $insecure = C4::Context->boolean_preference('insecure');
# finished authentification, now respond
if ( $loggedin || $authnotrequired || ( defined($insecure) && $insecure ) )
if ( $loggedin || $authnotrequired )
{
# successful login
unless ($cookie) {

View File

@ -67,7 +67,7 @@ our %strings = (
=item true_p
if ( C4::Boolean::true_p(C4::Context->preference("insecure")) ) {
if ( C4::Boolean::true_p(C4::Context->preference("IndependantBranches")) ) {
...
}

View File

@ -1083,18 +1083,8 @@ C<C4::Context-E<gt>userenv> twice, you will get the same hash without real DB ac
#'
sub userenv {
my $var = $context->{"activeuser"};
return $context->{"userenv"}->{$var} if (defined $var and defined $context->{"userenv"}->{$var});
# insecure=1 management
if ($context->{"dbh"} && $context->preference('insecure') eq 'yes') {
my %insecure;
$insecure{flags} = '16382';
$insecure{branchname} ='Insecure';
$insecure{number} ='0';
$insecure{cardnumber} ='0';
$insecure{id} = 'insecure';
$insecure{branch} = 'INS';
$insecure{emailaddress} = 'test@mode.insecure.com';
return \%insecure;
if (defined $var and defined $context->{"userenv"}->{$var}) {
return $context->{"userenv"}->{$var};
} else {
return;
}

View File

@ -258,9 +258,7 @@ sub Search {
if ( C4::Context->preference("IndependantBranches") ) { # && !$showallbranches){
if ( my $userenv = C4::Context->userenv ) {
my $branch = $userenv->{'branch'};
if ( ($userenv->{flags} % 2 !=1) &&
$branch && $branch ne "insecure" ){
if ( ($userenv->{flags} % 2 !=1) && $branch ){
if (my $fr = ref $filter) {
if ( $fr eq "HASH" ) {
$filter->{branchcode} = $branch;

View File

@ -32,7 +32,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('hide_marc',0,'If ON, disables display of MARC fields, subfield codes & indicators (still shows data)',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WaitingNotifyAtCheckin',0,'If ON, notify librarians of waiting holds for the patron whose items they are checking in.',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IndependantBranches',0,'If ON, increases security between libraries',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('insecure',0,'If ON, bypasses all authentication. Be careful!',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetBiblioDefaultView','normal','Choose the default detail view in the staff interface; choose between normal, labeled_marc, marc or isbd','normal|marc|isbd|labeled_marc','Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('intranetcolorstylesheet','','Define the color stylesheet to use in the Staff Client','50','free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IntranetmainUserblock','','Add a block of HTML that will display on the intranet home page','70|10','Textarea');

View File

@ -6550,6 +6550,13 @@ if ( CheckVersion($DBversion) ) {
SetVersion($DBversion);
}
$DBversion = "3.11.00.103";
if ( CheckVersion($DBversion) ) {
$dbh->do("DELETE FROM systempreferences WHERE variable = 'insecure';");
print "Upgrade to $DBversion done (Bug 9827 - Remove 'insecure' system preference)\n";
SetVersion($DBversion);
}
=head1 FUNCTIONS
=head2 TableExists($table)

View File

@ -41,13 +41,6 @@ Administration:
no: "Don't allow"
- staff and patrons to create and view saved lists of books.
Login options:
-
- pref: insecure
default: 0
choices:
yes: Allow
no: "Don't allow"
- staff to access the staff client without logging in. Enabling this is dangerous, and should not be done in production environments.
-
- Automatically log out users after
- pref: timeout

View File

@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts :
use strict;
sub kohaversion {
our $VERSION = '3.11.00.102';
our $VERSION = '3.11.00.103';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install

View File

@ -84,7 +84,7 @@ my ($count,$results);
if (C4::Context->preference("IndependantBranches")){
if (C4::Context->userenv && C4::Context->userenv->{flags} % 2 !=1 && C4::Context->userenv->{'branch'}){
$$patron{branchcode}=C4::Context->userenv->{'branch'} unless (C4::Context->userenv->{'branch'} eq "insecure");
$$patron{branchcode}=C4::Context->userenv->{'branch'};
}
}
$$patron{firstname}.="\%" if ($$patron{firstname});

View File

@ -31,7 +31,6 @@ svc/config/systempreferences - Web service for setting system preferences
=head1 SYNOPSIS
POST /svc/config/systempreferences/insecure
POST /svc/config/systempreferences/
=head1 DESCRIPTION

View File

@ -64,7 +64,7 @@ $contextmodule->mock('preference', sub {
return '490av';
} else {
warn "The syspref $pref was requested but I don't know what to say; this indicates that the test requires updating"
unless $pref =~ m/(XSLT|item|branch|holding|image|insecure)/i;
unless $pref =~ m/(XSLT|item|branch|holding|image)/i;
return 0;
}
});