@@ -, +, @@
StaffLoginRestrictBranchByIP
---
C4/Auth.pm | 12 +++++-----
C4/UsageStats.pm | 2 +-
.../data/mysql/atomicupdate/bug_26176.pl | 18 ++++++++++++++
installer/data/mysql/mandatory/sysprefs.sql | 4 ++--
.../intranet-tmpl/prog/en/includes/header.inc | 4 ++--
.../en/modules/admin/preferences/admin.pref | 4 ++--
t/db_dependent/Auth.t | 24 +++++++++----------
7 files changed, 43 insertions(+), 25 deletions(-)
create mode 100755 installer/data/mysql/atomicupdate/bug_26176.pl
--- a/C4/Auth.pm
+++ a/C4/Auth.pm
@@ -498,7 +498,7 @@ sub get_template_and_user {
advancedMARCEditor => C4::Context->preference("advancedMARCEditor"),
AllowMultipleCovers => C4::Context->preference('AllowMultipleCovers'),
AmazonCoverImages => C4::Context->preference("AmazonCoverImages"),
- AutoLocation => C4::Context->preference("AutoLocation"),
+ StaffLoginRestrictBranchByIP => C4::Context->preference("StaffLoginRestrictBranchByIP"),
can_see_cataloguing_module => haspermission( $user, get_cataloguing_page_permissions() ) ? 1 : 0,
canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'),
EasyAnalyticalRecords => C4::Context->preference('EasyAnalyticalRecords'),
@@ -1216,7 +1216,7 @@ sub checkauth {
}
if ( $type ne 'opac' ) {
my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search->as_list };
- if ( C4::Context->preference('AutoLocation') ) {
+ if ( C4::Context->preference('StaffLoginRestrictBranchByIP') ) {
# we have to check they are coming from the right ip range
my $domain = $branches->{$branchcode}->{'branchip'};
$domain =~ s|\.\*||g;
@@ -1238,12 +1238,12 @@ sub checkauth {
# If StaffLoginBranchBasedOnIP is enabled we will try to find a branch
# matching your ip, regardless of the choice you have passed in
(
- !C4::Context->preference('AutoLocation')
+ !C4::Context->preference('StaffLoginRestrictBranchByIP')
&& C4::Context->preference('StaffLoginBranchBasedOnIP')
)
- # When AutoLocation is enabled we will not choose a branch matching IP
+ # When StaffLoginRestrictBranchByIP is enabled we will not choose a branch matching IP
# if your selected branch has no IP set
- || ( C4::Context->preference('AutoLocation')
+ || ( C4::Context->preference('StaffLoginRestrictBranchByIP')
&& $auth_state ne 'failed'
&& $branches->{$branchcode}->{'branchip'} )
)
@@ -1444,7 +1444,7 @@ sub checkauth {
IntranetUserCSS => C4::Context->preference("IntranetUserCSS"),
IntranetUserJS => C4::Context->preference("IntranetUserJS"),
IndependentBranches => C4::Context->preference("IndependentBranches"),
- AutoLocation => C4::Context->preference("AutoLocation"),
+ StaffLoginRestrictBranchByIP => C4::Context->preference("StaffLoginRestrictBranchByIP"),
wrongip => $info{'wrongip'},
PatronSelfRegistration => C4::Context->preference("PatronSelfRegistration"),
PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"),
--- a/C4/UsageStats.pm
+++ a/C4/UsageStats.pm
@@ -146,7 +146,7 @@ sub _shared_preferences {
noItemTypeImages
OpacNoItemTypeImages
virtualshelves
- AutoLocation
+ StaffLoginRestrictBranchByIP
IndependentBranches
SessionStorage
Persona
--- a/installer/data/mysql/atomicupdate/bug_26176.pl
+++ a/installer/data/mysql/atomicupdate/bug_26176.pl
@@ -0,0 +1,18 @@
+use Modern::Perl;
+use Koha::Installer::Output qw(say_warning say_failure say_success say_info);
+
+return {
+ bug_number => "26176",
+ description => "Rename AutoLocation to StaffLoginRestrictBranchByIP",
+ up => sub {
+ my ($args) = @_;
+ my ( $dbh, $out ) = @$args{qw(dbh out)};
+
+ $dbh->do(q{
+ UPDATE systempreferences SET variable = "StaffLoginRestrictBranchByIP"
+ WHERE variable = "AutoLocation"
+ });
+
+ say $out "Renamed system preference 'AutoLocation' to 'StaffLoginRestrictBranchByIP'";
+ },
+};
--- a/installer/data/mysql/mandatory/sysprefs.sql
+++ a/installer/data/mysql/mandatory/sysprefs.sql
@@ -90,7 +90,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('AutoCreditNumber', '', '', 'Automatically generate a number for account credits', 'Choice'),
('AutoEmailNewUser','0',NULL,'Send an email to newly created patrons.','YesNo'),
('AutoLinkBiblios','0',NULL,'If enabled, link biblio to authorities on creation and edit','YesNo'),
-('AutoLocation','0',NULL,'If ON, IP authentication is enabled, blocking access to the staff interface from unauthorized IP addresses','YesNo'),
('AutomaticCheckinAutoFill','0',NULL,'Automatically fill the next hold with an automatic check in.','YesNo'),
('AutomaticConfirmTransfer','0',NULL,'Defines whether transfers should be automatically confirmed at checkin if modal dismissed','YesNo'),
('AutomaticItemReturn','1',NULL,'If ON, Koha will automatically set up a transfer of this item to its homebranch','YesNo'),
@@ -736,8 +735,9 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('StaffDetailItemSelection', '1', NULL, 'Enable item selection in record detail page', 'YesNo'),
('StaffHighlightedWords','1','','Highlight search terms on staff interface','YesNo'),
('StaffLangSelectorMode','footer','top|both|footer','Select the location to display the language selector in staff interface','Choice'),
-('StaffLoginInstructions', '', NULL, 'HTML to go into the login box for the staff interface','Free'),
('StaffLoginBranchBasedOnIP', '0','', 'Set the logged in library for the user based on their current IP','YesNo'),
+('StaffLoginInstructions', '', NULL, 'HTML to go into the login box for the staff interface','Free'),
+('StaffLoginRestrictBranchByIP','0',NULL,'If ON, IP authentication is enabled, blocking access to the staff interface from unauthorized IP addresses based on branch','YesNo'),
('StaffSearchResultsDisplayBranch','holdingbranch','holdingbranch|homebranch','Controls the display of the home or holding branch for staff search results','Choice'),
('StaffSerialIssueDisplayCount','3','','Number of serial issues to display per subscription in the staff interface','Integer'),
('staffShibOnly','0','','If ON enables shibboleth only authentication for the staff client','YesNo'),
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
+++ a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
@@ -95,7 +95,7 @@
[% SET is_superlibrarian = CAN_user_superlibrarian ? 'is_superlibrarian' : '' %]
[% logged_in_user.userid | html %]
[% logged_in_user.categorycode | html %]
- [% IF ( AutoLocation ) %]
+ [% IF ( StaffLoginRestrictBranchByIP ) %]