https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42383
--- Comment #204 from Tomás Cohen Arazi (tcohen) <[email protected]> --- Created attachment 211512 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211512&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 <[email protected]> Signed-off-by: Matt Blenkinsop <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ 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/
