Bug 34288: Allow access to the cataloguing module with `tools` permission
authorTomas Cohen Arazi <tomascohen@theke.io>
Fri, 14 Jul 2023 23:15:41 +0000 (20:15 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 19 Jul 2023 07:32:47 +0000 (08:32 +0100)
commitafacad6a2d5477870c55d8f0c56dec66bce64b9d
tree8c5093a91951ab5b1cedcbd044a9492f09627371
parent853ced5fa1f2a9d203e977de318b51407f121323
Bug 34288: Allow access to the cataloguing module with `tools` permission

Bug 31162 moved the cataloguing tools to a new cataloguing module home
page. This prevents people without cataloguing permissions, but with
some tools permissions to access things like the labels creator tool.

I tracked all permissions on the cataloging-home.tt template, including
the Stock Rotation ones which I initially missed because I was focusing
on tools.

This patch makes the cataloging-home.pl page require either
'cataloguing' or any relevant 'tools' permission to allow access. the
page.

The staff interface main page and the top bar dropdown are updated using
the same logic to display the cataloguing module link.

For that purpose, I wrapped the permissions on a sub in `C4::Auth`.

To test:
1. Have a patron with only 'catalogue' and some of this permissions:

* inventory
* items_batchdel
* items_batchmod
* items_batchmod
* label_creator
* manage_staged_marc
* marc_modification_templates
* records_batchdel
* records_batchmod
* stage_marc_import
* upload_cover_images
* stockrotation => manage_rotas

2. Log in
=> FAIL: No link to the cataloguing module, neither in the dropdown
3. Apply this patch
4. Repeat 2
=> SUCCESS: You have the link!
5. Play with the different combinations and notice things are sound and
   correct
6. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0db60995a8dd093210ffa772f56b7d5bac28d197)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
C4/Auth.pm
cataloguing/cataloging-home.pl
koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt