From b13db49d4f0195820882e93f2ca0646b322684d9 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Mon, 21 Oct 2024 09:51:42 +0000 Subject: [PATCH] Bug 34355: (QA follow-up) Add permission marc_order_manage to govern control of account creation --- admin/marc_order_accounts.pl | 1 + .../atomicupdate/bug_34355-add_marc_order_accounts.pl | 8 ++++++++ installer/data/mysql/mandatory/userpermissions.sql | 1 + .../intranet-tmpl/prog/en/includes/acquisitions-menu.inc | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc | 6 +++--- koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc | 5 +++++ .../intranet-tmpl/prog/en/modules/admin/admin-home.tt | 2 +- t/Koha/Auth/Permissions.t | 1 + 8 files changed, 22 insertions(+), 6 deletions(-) diff --git a/admin/marc_order_accounts.pl b/admin/marc_order_accounts.pl index acd969e997c..ce5899900bf 100755 --- a/admin/marc_order_accounts.pl +++ b/admin/marc_order_accounts.pl @@ -44,6 +44,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( template_name => "admin/marc_order_accounts.tt", query => $input, type => "intranet", + flagsrequired => { acquisition => 'marc_order_manage' }, } ); diff --git a/installer/data/mysql/atomicupdate/bug_34355-add_marc_order_accounts.pl b/installer/data/mysql/atomicupdate/bug_34355-add_marc_order_accounts.pl index 149afbeee96..c50eae6c66d 100755 --- a/installer/data/mysql/atomicupdate/bug_34355-add_marc_order_accounts.pl +++ b/installer/data/mysql/atomicupdate/bug_34355-add_marc_order_accounts.pl @@ -43,5 +43,13 @@ return { } ); + $dbh->do( + q{ + INSERT IGNORE INTO permissions (module_bit, code, description) values (11, 'marc_order_manage', 'Manage MARC ordering'); + } + ); + + + }, }; diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql index 83808b97a2d..d0fda8bc033 100644 --- a/installer/data/mysql/mandatory/userpermissions.sql +++ b/installer/data/mysql/mandatory/userpermissions.sql @@ -86,6 +86,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES (11, 'budget_add_del', 'Add and delete funds (but can''t modify funds)'), (11, 'budget_manage_all', 'Manage all funds'), (11, 'edi_manage', 'Manage EDIFACT transmissions'), + (11, 'marc_order_manage', 'Manage MARC ordering'), (11, 'reopen_closed_invoices', 'Reopen closed invoices'), (11, 'edit_invoices', 'Edit invoices'), (11, 'delete_invoices', 'Delete invoices'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc index a633ff21a20..819be190c7b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc @@ -24,7 +24,7 @@ [% END %] [% END %] - [% IF ( CAN_user_acquisition_period_manage || CAN_user_acquisition_budget_manage || CAN_user_acquisition_currencies_manage || ( Koha.Preference('EDIFACT') && CAN_user_acquisition_edi_manage ) || CAN_user_parameters_manage_additional_fields ) %] + [% IF ( CAN_user_acquisition_period_manage || CAN_user_acquisition_budget_manage || CAN_user_acquisition_currencies_manage || ( Koha.Preference('EDIFACT') && CAN_user_acquisition_edi_manage ) || CAN_user_parameters_manage_additional_fields ) || ( Koha.Preference('MarcOrderingAutomation') && CAN_user_acquisition_marc_order_manage ) %]
Administration
[% END %] - [% IF ( CAN_user_acquisition_currencies_manage || CAN_user_acquisition_period_manage || CAN_user_acquisition_budget_manage || ( Koha.Preference('EDIFACT') && CAN_user_acquisition_edi_manage ) ) %] + [% IF ( CAN_user_acquisition_currencies_manage || CAN_user_acquisition_period_manage || CAN_user_acquisition_budget_manage || ( Koha.Preference('EDIFACT') && CAN_user_acquisition_edi_manage ) ) || ( Koha.Preference('MarcOrderingAutomation') && CAN_user_acquisition_marc_order_manage ) %]
Acquisition parameters
[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index f5396703e76..d4c263b98c3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -827,6 +827,11 @@ Manage EDIFACT transmissions ([% name | html %]) + [%- CASE 'marc_order_manage' -%] + + Manage MARC ordering + + ([% name | html %]) [%- CASE 'reopen_closed_invoices' -%] Reopen closed invoices diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt index 336b48cb6be..8d40379e76f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -246,7 +246,7 @@
Library EANs
Manage library EDI EANs
[% END %] - [% IF Koha.Preference('MarcOrderingAutomation') %] + [% IF ( Koha.Preference('MarcOrderingAutomation') && CAN_user_acquisition_marc_order_manage ) %]
MARC order accounts
Manage vendor accounts for automated order line creation from marc records
[% END %] diff --git a/t/Koha/Auth/Permissions.t b/t/Koha/Auth/Permissions.t index 426b105855a..4b398646f3b 100755 --- a/t/Koha/Auth/Permissions.t +++ b/t/Koha/Auth/Permissions.t @@ -115,6 +115,7 @@ subtest 'superlibrarian tests' => sub { 'CAN_user_acquisition_group_manage' => 1, 'CAN_user_acquisition_issue_manage' => 1, 'CAN_user_acquisition_merge_invoices' => 1, + 'CAN_user_acquisition_marc_order_manage' => 1, 'CAN_user_acquisition_order_manage_all' => 1, 'CAN_user_acquisition_order_manage' => 1, 'CAN_user_acquisition_order_receive' => 1, -- 2.39.3 (Apple Git-146)