From 29456ce3d8115a2287fd7c103c9fd9acd9bbee1b Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 7 Nov 2018 13:04:51 +0000 Subject: [PATCH] Bug 14391: DBRev 18.06.00.052 Signed-off-by: Nick Clemens --- Koha.pm | 2 +- .../bug14391_granular_admin_permissions.perl | 122 ----------------- installer/data/mysql/updatedatabase.pl | 123 ++++++++++++++++++ 3 files changed, 124 insertions(+), 123 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug14391_granular_admin_permissions.perl diff --git a/Koha.pm b/Koha.pm index ae5c664910..7cdc1f3370 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "18.06.00.051"; +$VERSION = "18.06.00.052"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug14391_granular_admin_permissions.perl b/installer/data/mysql/atomicupdate/bug14391_granular_admin_permissions.perl deleted file mode 100644 index 9b6a9ccf0d..0000000000 --- a/installer/data/mysql/atomicupdate/bug14391_granular_admin_permissions.perl +++ /dev/null @@ -1,122 +0,0 @@ -$DBversion = 'XXX'; -if( CheckVersion( $DBversion ) ) { - $dbh->do(q{ - INSERT IGNORE INTO permissions (module_bit, code, description) VALUES - ( 3, 'manage_sysprefs', 'Manage global system preferences'), - ( 3, 'manage_libraries', 'Manage libraries and library groups'), - ( 3, 'manage_itemtypes', 'Manage item types'), - ( 3, 'manage_auth_values', 'Manage authorized values'), - ( 3, 'manage_patron_categories', 'Manage patron categories'), - ( 3, 'manage_patron_attributes', 'Manage extended patron attributes'), - ( 3, 'manage_transfers', 'Manage library transfer limits and transport cost matrix'), - ( 3, 'manage_item_circ_alerts', 'Manage item circulation alerts'), - ( 3, 'manage_cities', 'Manage cities and towns'), - ( 3, 'manage_marc_frameworks', 'Manage MARC bibliographic and authority frameworks'), - ( 3, 'manage_keywords2koha_mappings', 'Manage keywords to Koha mappings'), - ( 3, 'manage_classifications', 'Manage classification sources'), - ( 3, 'manage_matching_rules', 'Manage record matching rules'), - ( 3, 'manage_oai_sets', 'Manage OAI sets'), - ( 3, 'manage_item_search_fields', 'Manage item search fields'), - ( 3, 'manage_search_engine_config', 'Manage search engine configuration'), - ( 3, 'manage_search_targets', 'Manage Z39.50 and SRU server configuration'), - ( 3, 'manage_didyoumean', 'Manage Did you mean? configuration'), - ( 3, 'manage_column_config', 'Manage column configuration'), - ( 3, 'manage_sms_providers', 'Manage SMS cellular providers'), - ( 3, 'manage_audio_alerts', 'Manage audio alerts'), - ( 3, 'manage_usage_stats', 'Manage usage statistics settings'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_sysprefs' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_libraries' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_itemtypes' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_auth_values' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_patron_categories' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_patron_attributes' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_transfers' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_item_circ_alerts' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_cities' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_marc_frameworks' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_keywords2koha_mappings' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_classifications' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_matching_rules' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_oai_sets' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_item_search_fields' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_search_engine_config' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_search_targets' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_didyoumean' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_column_config' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_sms_providers' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_audio_alerts' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_usage_stats' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); - }); - $dbh->do(q{ - INSERT INTO user_permissions (borrowernumber, module_bit, code) - SELECT borrowernumber, 3, 'manage_item_search_fields' FROM borrowers WHERE flags & (1 << 2); - }); - SetVersion( $DBversion ); - print "Upgrade to $DBversion done (Bug 14391: Add granular permissions to the administration module)\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index d1082c3582..23acba4894 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -16786,6 +16786,129 @@ if( CheckVersion( $DBversion ) ) { SetVersion( $DBversion ); } +$DBversion = '18.06.00.052'; +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + INSERT IGNORE INTO permissions (module_bit, code, description) VALUES + ( 3, 'manage_sysprefs', 'Manage global system preferences'), + ( 3, 'manage_libraries', 'Manage libraries and library groups'), + ( 3, 'manage_itemtypes', 'Manage item types'), + ( 3, 'manage_auth_values', 'Manage authorized values'), + ( 3, 'manage_patron_categories', 'Manage patron categories'), + ( 3, 'manage_patron_attributes', 'Manage extended patron attributes'), + ( 3, 'manage_transfers', 'Manage library transfer limits and transport cost matrix'), + ( 3, 'manage_item_circ_alerts', 'Manage item circulation alerts'), + ( 3, 'manage_cities', 'Manage cities and towns'), + ( 3, 'manage_marc_frameworks', 'Manage MARC bibliographic and authority frameworks'), + ( 3, 'manage_keywords2koha_mappings', 'Manage keywords to Koha mappings'), + ( 3, 'manage_classifications', 'Manage classification sources'), + ( 3, 'manage_matching_rules', 'Manage record matching rules'), + ( 3, 'manage_oai_sets', 'Manage OAI sets'), + ( 3, 'manage_item_search_fields', 'Manage item search fields'), + ( 3, 'manage_search_engine_config', 'Manage search engine configuration'), + ( 3, 'manage_search_targets', 'Manage Z39.50 and SRU server configuration'), + ( 3, 'manage_didyoumean', 'Manage Did you mean? configuration'), + ( 3, 'manage_column_config', 'Manage column configuration'), + ( 3, 'manage_sms_providers', 'Manage SMS cellular providers'), + ( 3, 'manage_audio_alerts', 'Manage audio alerts'), + ( 3, 'manage_usage_stats', 'Manage usage statistics settings'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_sysprefs' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_libraries' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_itemtypes' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_auth_values' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_patron_categories' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_patron_attributes' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_transfers' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_item_circ_alerts' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_cities' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_marc_frameworks' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_keywords2koha_mappings' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_classifications' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_matching_rules' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_oai_sets' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_item_search_fields' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_search_engine_config' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_search_targets' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_didyoumean' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_column_config' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_sms_providers' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_audio_alerts' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_usage_stats' FROM borrowers WHERE borrowernumber IN (SELECT borrowernumber FROM user_permissions WHERE code = 'parameters_remaining_permissions'); + }); + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 3, 'manage_item_search_fields' FROM borrowers WHERE flags & (1 << 2); + }); + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 14391: Add granular permissions to the administration module)\n"; +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.39.5