Bug 24537: Tidy code

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Kyle M Hall 2020-04-01 06:19:24 -04:00 committed by Martin Renvoize
parent cede9bbe43
commit dd55209f25
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 6 additions and 6 deletions

View File

@ -164,19 +164,19 @@ unless ( C4::Context->preference('ILS-DI') ) {
}
# If the remote address is not allowed, redirect to 403
my @AuthorizedIPs = split(/,/, C4::Context->preference('ILS-DI:AuthorizedIPs'));
if ( @AuthorizedIPs ){ # If no filter set, allow access to everybody
my @AuthorizedIPs = split( /,/, C4::Context->preference('ILS-DI:AuthorizedIPs') );
if (@AuthorizedIPs) { # If no filter set, allow access to everybody
my $authorized = 0;
foreach my $ip (@AuthorizedIPs){
foreach my $ip (@AuthorizedIPs) {
my $netmask = Net::Netmask->new2($ip);
if ( $netmask && $netmask->match($ENV{'REMOTE_ADDR'}) ){
if ( $netmask && $netmask->match( $ENV{REMOTE_ADDR} ) ) {
$authorized = 1;
last;
}
}
unless ($authorized){
unless ($authorized) {
$out->{'code'} = "NotAllowed";
$out->{'message'} = "Unauthorized IP address: ".$ENV{'REMOTE_ADDR'}.".";
$out->{'message'} = "Unauthorized IP address: $ENV{REMOTE_ADDR}.";
}
}