https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43258

            Bug ID: 43258
           Summary: Add a centralized IP range matching helper
   Initiative type: ---
        Sponsorship ---
            status:
           Product: Koha
           Version: Main
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
        Depends on: 20846
  Target Milestone: ---

Several OPAC features check whether the client IP matches a configured range
(OpacSuppressionByIPRange, RestrictedPageLocalIPs, SelfCheckAllowByIPRanges,
etc). Each repeats the same inline pattern:

  my $ip_address = $ENV{'REMOTE_ADDR'};
  my $in_range = ( $ip_address =~ /^$ip_range/ );

This should be centralized into a helper method (e.g. on C4::Context or a
utility class) so callers can simply ask 'does the current request match this
range?' without reimplementing the logic.

A centralized helper would also be the right place to:
- Handle edge cases (undef REMOTE_ADDR, empty range)
- Document that the matching is regex-based, not CIDR
- Eventually support CIDR notation if needed


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20846
[Bug 20846] Suppressed records still appear in public lists
-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to