From ff83c7acdcb4e7f5004941024397aca48e327414 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Sun, 20 May 2018 23:47:53 +0200 Subject: [PATCH] Bug 7651: Add a new permission for managing currencies and exchange rates At the moment staff users need parameters or parameters_remaining_permissions in order to be able to change exchange rates for acquisition orders. This patch adds a new separate permission currencies_manage and updates staff users currently having those permissions to get the new permission as well. To test: - Create some staff users with different permission sets 1) superlibrarian 2) parameters 3) parameters_remaining_permissions 4) manage_circ_rules, but not parmeters_remaining_permissions 5) all acquisition permissions - Apply patch and run database update - Verify new permission has been added and staff users updated 1) remains the same 2) + 3) will have currencies_manage 4) remains unchanged, doesn't have new permission 5) remains the same, will have access now because of having the top level acquisition permission - Verify the changed pages work correctly: - navigation on admin home page NOTE: the acquisition parameters section will now honor all different related permissions (edi_manage, budget_manage,...) - navigation on acquisition home page - try to access currencies page directly Signed-off-by: Charles Farmer Signed-off-by: Jonathan Druart Signed-off-by: Nick Clemens --- admin/currency.pl | 2 +- .../bug763_currencies_manage_permission.sql | 7 +++++++ installer/data/mysql/userpermissions.sql | 1 + .../prog/en/includes/acquisitions-menu.inc | 2 +- .../intranet-tmpl/prog/en/includes/permissions.inc | 1 + .../prog/en/modules/admin/admin-home.tt | 14 +++++++++++--- 6 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug763_currencies_manage_permission.sql diff --git a/admin/currency.pl b/admin/currency.pl index 4305454802..41003aeca9 100755 --- a/admin/currency.pl +++ b/admin/currency.pl @@ -40,7 +40,7 @@ our ( $template, $loggedinuser, $cookie ) = get_template_and_user( query => $input, type => 'intranet', authnotrequired => 0, - flagsrequired => { parameters => 'parameters_remaining_permissions' }, + flagsrequired => { acquisition => 'currencies_manage' }, } ); diff --git a/installer/data/mysql/atomicupdate/bug763_currencies_manage_permission.sql b/installer/data/mysql/atomicupdate/bug763_currencies_manage_permission.sql new file mode 100644 index 0000000000..a8a74ee202 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug763_currencies_manage_permission.sql @@ -0,0 +1,7 @@ +INSERT INTO permissions (module_bit, code, description) VALUES (11, 'currencies_manage', 'Manage currencies and exchange rates'); + +INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 11, 'currencies_manage' FROM borrowers WHERE flags & (1 << 3) OR borrowernumber IN + (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + +-- Bug 7651: Add new permission currencies_manage and update staff users diff --git a/installer/data/mysql/userpermissions.sql b/installer/data/mysql/userpermissions.sql index 07c7d5de20..93d030b410 100644 --- a/installer/data/mysql/userpermissions.sql +++ b/installer/data/mysql/userpermissions.sql @@ -17,6 +17,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'delete_all_items', 'Delete all items at once'), (10, 'writeoff', 'Write off fines and fees'), (10, 'remaining_permissions', 'Remaining permissions for managing fines and fees'), + (11, 'currencies_manage', 'Manage currencies and exchange rates'), (11, 'vendors_manage', 'Manage vendors'), (11, 'contracts_manage', 'Manage contracts'), (11, 'period_manage', 'Manage budgets'), 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 8d46d87939..7ef091747e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc @@ -18,7 +18,7 @@
  • Budgets
  • Funds
  • [% END %] - [% IF ( CAN_user_parameters ) %] + [% IF ( CAN_user_acquisition_currencies_manage ) %]
  • Currencies
  • [% END %] [% IF CAN_user_acquisition_edi_manage %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index 129d7f5593..c5330865fb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -56,6 +56,7 @@ [%- CASE 'period_manage' -%]Manage budgets [%- CASE 'planning_manage' -%]Manage budget plannings [%- CASE 'vendors_manage' -%]Manage vendors + [%- CASE 'currencies_manage' -%]Manage currencies and exchange rates [%- CASE 'batch_upload_patron_images' -%]Upload patron images in a batch or one at a time [%- CASE 'delete_anonymize_patrons' -%]Delete old borrowers and anonymize circulation history (deletes borrower reading history) [%- CASE 'edit_calendar' -%]Define days when the library is closed 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 c0c1917691..0005255032 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 @@ -95,22 +95,30 @@ [% END %] + [% IF ( CAN_user_acquisition_currencies_manage || CAN_user_acquisition_period_manage + || CAN_user_acquisition_budget_manage || CAN_user_acquisition_edi_manage ) %]

    Acquisition parameters

    + [% IF ( CAN_user_acquisition_currencies_manage ) %]
    Currencies and exchange rates
    Define currencies and exchange rates used for acquisitions.
    - + [% END %] + [% IF ( CAN_user_acquisition_period_manage ) %]
    Budgets
    Define your budgets
    - + [% END %] + [% IF ( CAN_user_acquisition_budget_manage ) %]
    Funds
    Define funds within your budgets
    - + [% END %] + [% IF ( CAN_user_acquisition_edi_manage ) %]
    EDI accounts
    Manage vendor EDI accounts for import/export
    Library EANs
    Manage library EDI EANs
    + [% END %]
    + [% END %]

    Additional parameters

    -- 2.39.5