From 7d9439b7d40f1ceb7c82cbdcbcbd24009a769744 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Wed, 16 May 2018 01:19:53 +0200 Subject: [PATCH] Bug 2426: Remove deprecated management permission After review of the code it turns out that the management permission that has been marked as deprecated a long time ago, does not have any function. The patch removes all remaining code related to it. To test: - Make sure you have a patron with the management permission - Apply patch - Run database update - Check everything still works as expected Bonus: borrowers.flags is recalculated for patrons with management permission. To check: - Create some 'permission twins' with and without management permission - Note the value in borrowers.flags - Apply patch, don't run database update - Save permissions from GUI for one of the twins - Note the newly calculated value - Run database update - Now both twins should have the same borrowers.flags value --- C4/Auth.pm | 6 +----- .../bug2426_remove_management_permission.sql | 3 +++ installer/data/mysql/userflags.sql | 1 - koha-tmpl/intranet-tmpl/prog/en/includes/header.inc | 2 +- koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc | 1 - .../prog/en/modules/help/members/member-flags.tt | 9 --------- t/db_dependent/Auth.t | 2 +- t/db_dependent/Search/History.t | 2 +- 8 files changed, 7 insertions(+), 19 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug2426_remove_management_permission.sql diff --git a/C4/Auth.pm b/C4/Auth.pm index 7442b1dd78..c4dd0c4238 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -289,7 +289,7 @@ sub get_template_and_user { my $all_perms = get_all_subpermissions(); my @flagroots = qw(circulate catalogue parameters borrowers permissions reserveforothers borrow - editcatalogue updatecharges management tools editauthorities serials reports acquisition clubs); + editcatalogue updatecharges tools editauthorities serials reports acquisition clubs); # We are going to use the $flags returned by checkauth # to create the template's parameters that will indicate @@ -304,7 +304,6 @@ sub get_template_and_user { $template->param( CAN_user_editcatalogue => 1 ); $template->param( CAN_user_updatecharges => 1 ); $template->param( CAN_user_acquisition => 1 ); - $template->param( CAN_user_management => 1 ); $template->param( CAN_user_tools => 1 ); $template->param( CAN_user_editauthorities => 1 ); $template->param( CAN_user_serials => 1 ); @@ -340,9 +339,6 @@ sub get_template_and_user { foreach my $module ( keys %$flags ) { if ( $flags->{$module} == 1 or ref( $flags->{$module} ) ) { $template->param( "CAN_user_$module" => 1 ); - if ( $module eq "parameters" ) { - $template->param( CAN_user_management => 1 ); - } } } } diff --git a/installer/data/mysql/atomicupdate/bug2426_remove_management_permission.sql b/installer/data/mysql/atomicupdate/bug2426_remove_management_permission.sql new file mode 100644 index 0000000000..884721d433 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug2426_remove_management_permission.sql @@ -0,0 +1,3 @@ +DELETE FROM userflags WHERE bit = 12 AND flag = 'management'; +UPDATE borrowers SET flags = flags - ( flags & (1<<12) ) WHERE flags & (1 << 12); +-- Bug 2426 - Remove deprecated management permission diff --git a/installer/data/mysql/userflags.sql b/installer/data/mysql/userflags.sql index 3e8f5dc244..ae3647810d 100644 --- a/installer/data/mysql/userflags.sql +++ b/installer/data/mysql/userflags.sql @@ -9,7 +9,6 @@ INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES (9,'editcatalogue','Edit catalog (Modify bibliographic/holdings data)',0), (10,'updatecharges','Manage patrons fines and fees',0), (11,'acquisition','Acquisition and/or suggestion management',0), -(12,'management','Set library management parameters (deprecated)',0), (13,'tools','Use all tools (expand for granular tools permissions)',0), (14,'editauthorities','Edit authorities',0), (15,'serials','Manage serial subscriptions',0), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc index 365abbc2a3..3c112ee70c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc @@ -101,7 +101,7 @@ [% IF ( IndependentBranches ) %] - [% IF ( CAN_user_management || CAN_user_editcatalogue_edit_catalogue ) %] + [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
  • Set library
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index 017ffb918e..4de96f8613 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -10,7 +10,6 @@ [%- CASE 'editcatalogue' -%]Edit catalog (Modify bibliographic/holdings data) [%- CASE 'updatecharges' -%]Manage patrons fines and fees [%- CASE 'acquisition' -%]Acquisition and/or suggestion management - [%- CASE 'management' -%]Set library management parameters (deprecated) [%- CASE 'tools' -%]Use all tools (expand for granular tools permissions) [%- CASE 'editauthorities' -%]Edit authorities [%- CASE 'serials' -%]Manage serial subscriptions diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/member-flags.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/member-flags.tt index b3bf18843c..ad549b1c47 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/member-flags.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/member-flags.tt @@ -85,15 +85,6 @@
  • Acquisition and/or suggestion management
  • This section can be expanded
  • - -
  • management -
  • tools