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

--- Comment #213 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 211705
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211705&action=edit
Bug 42383: Add Koha::Module::Policy framework

This patch adds a module policy framework that exposes per-module
capabilities to the UI. It replaces the pattern of dedicated GET /config
endpoints (like GET /erm/config) with a session-scoped mechanism.

A module policy is the intersection of system preferences (feature
toggles), user permissions and library context. It is a plain JSON
structure: an envelope with the module name, a 'global' block with the
keys common to all modules, and the module specific keys under the
module name:

    {
        module  => 'checkin',
        global  => { audio_alerts => true, ... },
        checkin => { exempt_fine => false, ... },
    }

The page is bootstrapped with the policy, and the API returns it in the
error object when it refuses a request because of it, so the client can
refresh the UI. The server remains authoritative: the policy is
informational, not an access token.

Components:
- Koha::Module::Policy: base class with new(), module(), to_hashref()
  and scope()
- Koha::Module::Policy::Checkin: check-in module policy covering fines,
  holds, recalls, transfers, display and blockers

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Module/Policy.t \
           t/db_dependent/Koha/Module/Policy/Checkin.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]>
Signed-off-by: Martin Renvoize <[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