For this to work you have to alter the database ( or the RM has to add to
updatedatabase.pl ) with the sql:
ALTER TABLE branches MODIFY COLUMN branchip MEDUIMTEXT DEFAULT NULL;
---
C4/Auth.pm | 32 +++++++++++++++++++++-----------
1 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/C4/Auth.pm b/C4/Auth.pm
index 3c00b54..55174a2 100755
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -649,7 +649,13 @@ sub checkauth {
if
(C4::Context->boolean_preference('IndependantBranches') &&
C4::Context->boolean_preference('Autolocation')){
# we have to check they are
coming from the right ip range
my $domain =
$branches->{$branchcode}->{'branchip'};
- if ($ip !~ /^$domain/){
+ my $match = 0;
+ foreach my $subdomain ( split
/\|/, $domain ) {
+ if ( $ip =~
/^$subdomain/ ) {
+ $match = 1;
+ }
+ }
+ unless ( $match ) {
$loggedin=0;
$info{'wrongip'} = 1;
}
@@ -659,12 +665,14 @@ sub checkauth {
foreach my $br ( keys %$branches ) {
# now we work with the
treatment of ip
my $domain =
$branches->{$br}->{'branchip'};
- if ( $domain && $ip =~
/^$domain/ ) {
- $branchcode =
$branches->{$br}->{'branchcode'};
+ foreach my $subdomain ( split
/\|/, $domain ) {
+ if ( $subdomain && $ip
=~ /^$subdomain/ ) {
+ $branchcode =
$branches->{$br}->{'branchcode'};
- # new op dev : add the
branchprinter and branchname in the cookie
- $branchprinter =
$branches->{$br}->{'branchprinter'};
- $branchname =
$branches->{$br}->{'branchname'};
+ # new op dev :
add the branchprinter and branchname in the cookie
+ $branchprinter
= $branches->{$br}->{'branchprinter'};
+ $branchname
= $branches->{$br}->{'branchname'};
+ }
}
}
$session->param('number',$borrowernumber);
@@ -1009,12 +1017,14 @@ sub check_api_auth {
foreach my $br ( keys %$branches ) {
# now we work with the treatment of ip
my $domain = $branches->{$br}->{'branchip'};
- if ( $domain && $ip =~ /^$domain/ ) {
- $branchcode = $branches->{$br}->{'branchcode'};
+ foreach my $subdomain ( split /\|/, $domain ) {
+ if ( $subdomain && $ip =~ /^$subdomain/ ) {
+ $branchcode = $branches->{$br}->{'branchcode'};
- # new op dev : add the branchprinter and branchname in
the cookie
- $branchprinter = $branches->{$br}->{'branchprinter'};
- $branchname = $branches->{$br}->{'branchname'};
+ # new op dev : add the branchprinter and branchname
in the cookie
+ $branchprinter =
$branches->{$br}->{'branchprinter'};
+ $branchname = $branches->{$br}->{'branchname'};
+ }
}
}
$session->param('number',$borrowernumber);
--
1.5.4.3
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches