From 4d9b8aac218de29822d40e8b0f31198c04c4a017 Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Mon, 29 Jul 2019 09:08:41 +0100 Subject: [PATCH] Bug 23112: Add permission checks We only want the ILL circulation functionality to be available if the appropriate syspref and perm are available, this patch adds those checks. Sponsored-by: Loughborough University --- Koha/Illrequest.pm | 2 ++ .../intranet-tmpl/prog/en/modules/ill/ill-requests.tt | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm index 519fadb638..998422a788 100644 --- a/Koha/Illrequest.pm +++ b/Koha/Illrequest.pm @@ -493,6 +493,8 @@ sub _core_status_graph { id => 'CHK', name => 'Checked out', ui_method_name => 'Check out', + needs_prefs => [ 'CirculateILL' ], + needs_perms => [ 'user_circulate_circulate_remaining_permissions' ], method => 'check_out', next_actions => [ ], ui_method_icon => 'fa-upload', diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt index bda27e71b5..5088252f60 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt @@ -439,6 +439,22 @@ Edit request [% FOREACH action IN request.available_actions %] + [% needs_prefs = action.needs_prefs.size ? action.needs_prefs : [] %] + [% needs_perms = action.needs_perms.size ? action.needs_perms : [] %] + [% has_prefs_count = 0 %] + [% has_perms_count = 0 %] + [% FOREACH pref IN needs_prefs %] + [% IF Koha.Preference(pref) %] + [% has_prefs_count = has_prefs_count + 1 %] + [% END %] + [% END %] + [% FOREACH perm IN needs_perms %] + [% perm_name = 'CAN_' _ perm %] + [% IF ($perm_name) %] + [% has_perms_count = has_perms_count + 1 %] + [% END %] + [% END %] + [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size %] [% IF action.method == 'migrate' %] [% IF backends.size > 2 %]