https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43258 --- Comment #9 from David Nind <david@davidnind.com> --- Created attachment 203427 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203427&action=edit Bug 43258: (follow-up) Add Koha::REST::Plugin::Restrictions Add a Mojolicious plugin that provides the ip_in_range helper for REST API controllers. It wraps Koha::IP->is_ip_in_range(), sourcing the client IP from $c->tx->remote_address (the Mojo equivalent of $ENV{REMOTE_ADDR}). Usage in controllers: if ( $c->ip_in_range( C4::Context->preference('OpacSuppressionByIPRange') ) ) { # client is in the exception range } The plugin is registered in Koha::REST::V1 startup alongside the existing plugins (Pagination, Query, Objects, Exceptions). Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/Koha/REST/Plugin/Restrictions.t => SUCCESS: All tests pass 3. Tests verify the helper correctly delegates to Koha::IP using the request's remote address (127.0.0.1 from Test::Mojo) 4. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.