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

--- Comment #20 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 209553
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209553&action=edit
Bug 42383: Add Koha::REST::Plugin::Policy

This patch adds a Mojolicious plugin that provides the
attach_module_policy helper to any API controller.

Usage:
    $c->attach_module_policy('Checkin');
    $c->attach_module_policy('Checkin', { library => $library_id });

The helper dynamically loads the appropriate Koha::Module::Policy
subclass, generates the JWT, and sets the X-Koha-Module-Policy
response header. This avoids duplicating policy attachment logic
across controllers.

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
   k$ prove t/db_dependent/api/v1/checkins.t
=> SUCCESS: Tests pass
3. Sign off :-D

Signed-off-by: Tomás Cohen Arazi <[email protected]>
Signed-off-by: Brendan Lawlor <[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/

Reply via email to