https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42383 --- Comment #214 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 211706 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211706&action=edit Bug 42383: Add Koha::REST::Plugin::Policy This patch adds a Mojolicious plugin that provides the module_policy helper to API controllers: return $c->render( status => 403, openapi => { error => 'Return date override is not enabled', error_code => 'return_date_not_allowed', policy => $c->module_policy( 'Checkin', { library => $library_id } ), } ); The helper loads the matching Koha::Module::Policy subclass and returns the policy envelope for the authenticated user, so controllers can include it in the 'policy' attribute of the error object when refusing a request because of it. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/REST/Plugin/Policy.t => SUCCESS: Tests pass! 3. Sign off :-D Assisted-by: Sonnet 4.6 (Anthropic) Assisted-by: Opus 5.5 (Anthropic) Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> -- You are receiving this mail because: You are watching all bug changes.