From 5f065e225e02572af8a93cf6e25c58711150fc44 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 25 Apr 2014 16:45:57 +0200 Subject: [PATCH] Bug 7673: DB changes - Add permissions This patch adds: 3 permissions: - edit_items_restricted - delete_all_items - items_batchmod_restricted 2 system preferences: - SubfieldsToAllowForRestrictedEdition - SubfieldsToAllowForRestrictedBatchmod. Signed-off-by: Koha Team AMU Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../mysql/de-DE/mandatory/userpermissions.sql | 3 ++ .../mysql/en/mandatory/userpermissions.sql | 3 ++ .../mysql/es-ES/mandatory/userpermissions.sql | 3 ++ .../fr-FR/1-Obligatoire/userpermissions.sql | 3 ++ .../mysql/it-IT/necessari/userpermissions.sql | 3 ++ .../nb-NO/1-Obligatorisk/userpermissions.sql | 3 ++ .../mysql/pl-PL/mandatory/userpermissions.sql | 3 ++ .../mandatory/permissions_and_user_flags.sql | 3 ++ .../mandatory/permissions_and_user_flags.sql | 3 ++ installer/data/mysql/updatedatabase.pl | 32 +++++++++++++++++++ .../admin/preferences/cataloguing.pref | 14 ++++++++ 11 files changed, 73 insertions(+) diff --git a/installer/data/mysql/de-DE/mandatory/userpermissions.sql b/installer/data/mysql/de-DE/mandatory/userpermissions.sql index 59e6baba1e..ce30cdf2ae 100644 --- a/installer/data/mysql/de-DE/mandatory/userpermissions.sql +++ b/installer/data/mysql/de-DE/mandatory/userpermissions.sql @@ -11,6 +11,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Katalogdaten bearbeiten (Titel- und Exemplardaten ändern)'), ( 9, 'fast_cataloging', 'Schnellaufnahmen anlegen'), ( 9, 'edit_items', 'Exemplare bearbeiten'), + ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEdition preference (please note that edit_item is still required)'), + ( 9, 'delete_all_items', 'Delete all items at once'), (10, 'writeoff', 'Gebühren erlassen'), (10, 'remaining_permissions', 'Verbleibende Berechtigungen für die Verwaltung von Gebühren'), (11, 'vendors_manage', 'Lieferanten verwalten'), @@ -43,6 +45,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES (13, 'batch_upload_patron_images', 'Benutzerfotos einzeln oder im Stapel hochladen'), (13, 'schedule_tasks', 'Aufgabenplaner verwenden'), (13, 'items_batchmod', 'Stapelbearbeitung von Exemplaren durchführen'), + (13, 'items_batchmod_restricted', 'Limit batch item modification to subfields defined in the SubfieldsToAllowForRestrictedBatchmod preference (please note that items_batchmod is still required)'), (13, 'items_batchdel', 'Stapellöschung von Exemplaren durchführen'), (13, 'manage_csv_profiles', 'CSV-Profile für Export verwalten'), (13, 'moderate_tags', 'Von Benutzern vergebene Tags moderieren'), diff --git a/installer/data/mysql/en/mandatory/userpermissions.sql b/installer/data/mysql/en/mandatory/userpermissions.sql index f8e3e9d939..8bf71d886d 100644 --- a/installer/data/mysql/en/mandatory/userpermissions.sql +++ b/installer/data/mysql/en/mandatory/userpermissions.sql @@ -11,6 +11,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), ( 9, 'fast_cataloging', 'Fast cataloging'), ( 9, 'edit_items', 'Edit items'), + ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEdition preference (please note that edit_item is still required)'), + ( 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, 'vendors_manage', 'Manage vendors'), @@ -43,6 +45,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES (13, 'batch_upload_patron_images', 'Upload patron images in a batch or one at a time'), (13, 'schedule_tasks', 'Schedule tasks to run'), (13, 'items_batchmod', 'Perform batch modification of items'), + (13, 'items_batchmod_restricted', 'Limit batch item modification to subfields defined in the SubfieldsToAllowForRestrictedBatchmod preference (please note that items_batchmod is still required)'), (13, 'items_batchdel', 'Perform batch deletion of items'), (13, 'manage_csv_profiles', 'Manage CSV export profiles'), (13, 'moderate_tags', 'Moderate patron tags'), diff --git a/installer/data/mysql/es-ES/mandatory/userpermissions.sql b/installer/data/mysql/es-ES/mandatory/userpermissions.sql index 8b7cc2672b..698ccfe1aa 100644 --- a/installer/data/mysql/es-ES/mandatory/userpermissions.sql +++ b/installer/data/mysql/es-ES/mandatory/userpermissions.sql @@ -11,6 +11,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), ( 9, 'fast_cataloging', 'Fast cataloging'), ( 9, 'edit_items', 'Edit Items'), + ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEdition preference (please note that edit_item is still required)'), + ( 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, 'vendors_manage', 'Manage vendors'), @@ -43,6 +45,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES (13, 'batch_upload_patron_images', 'Upload patron images in a batch or one at a time'), (13, 'schedule_tasks', 'Schedule tasks to run'), (13, 'items_batchmod', 'Perform batch modification of items'), + (13, 'items_batchmod_restricted', 'Limit batch item modification to subfields defined in the SubfieldsToAllowForRestrictedBatchmod preference (please note that items_batchmod is still required)'), (13, 'items_batchdel', 'Perform batch deletion of items'), (13, 'manage_csv_profiles', 'Manage CSV export profiles'), (13, 'moderate_tags', 'Moderate patron tags'), diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql b/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql index b70438a05e..15f446e1a1 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql @@ -11,6 +11,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Ajouter et modifier des notices au catalogue'), ( 9, 'fast_cataloging', 'Catalogage rapide'), ( 9, 'edit_items', 'Modifier des exemplaires'), + ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEdition preference (please note that edit_item is still required)'), + ( 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'), (13, 'edit_news', 'Ecrire des nouvelles pour l''OPAC et l''interface professionnelle'), @@ -47,6 +49,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES (13, 'moderate_tags', 'Modérer les tags des adhérents'), (13, 'rotating_collections', 'Gérer les collections tournantes'), (13, 'items_batchmod', 'Modifier les exemplaires par lot'), + (13, 'items_batchmod_restricted', 'Limit batch item modification to subfields defined in the SubfieldsToAllowForRestrictedBatchmod preference (please note that items_batchmod is still required)'), (13, 'items_batchdel', 'Supprimer les exemplaires par lot'), (13, 'upload_local_cover_images', 'Téléchargement des images de couverture'), (13, 'manage_patron_lists', 'Add, edit and delete patron lists and their contents'), diff --git a/installer/data/mysql/it-IT/necessari/userpermissions.sql b/installer/data/mysql/it-IT/necessari/userpermissions.sql index 3ad8ff7303..1ab8607c56 100644 --- a/installer/data/mysql/it-IT/necessari/userpermissions.sql +++ b/installer/data/mysql/it-IT/necessari/userpermissions.sql @@ -11,6 +11,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Cataloga (crea/modifica dati bibliografici e di copia)'), ( 9, 'fast_cataloging', 'Catalogazione veloce'), ( 9, 'edit_items', 'Crea/modifica copie'), + ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEdition preference (please note that edit_item is still required)'), + ( 9, 'delete_all_items', 'Delete all items at once'), (10, 'writeoff', 'Cancellare multe e tariffe'), (10, 'remaining_permissions', 'Permessi rimanenti per gestione multe e costi'), (11, 'vendors_manage', 'Crea/modifica fornitori'), @@ -43,6 +45,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES (13, 'batch_upload_patron_images', 'Aggiorna le foto utente in modalità batch o al momento'), (13, 'schedule_tasks', 'Schedula i task'), (13, 'items_batchmod', 'Abilita alla modifica batch delle copie'), + (13, 'items_batchmod_restricted', 'Limit batch item modification to subfields defined in the SubfieldsToAllowForRestrictedBatchmod preference (please note that items_batchmod is still required)'), (13, 'items_batchdel', 'Abilita alla cancellazione via batch delle copie'), (13, 'manage_csv_profiles', 'Gestisci i profili CSV di export'), (13, 'moderate_tags', 'Modera i tag inseriti dagli utenti'), diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql b/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql index bcc117528b..551bb9b193 100644 --- a/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql +++ b/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql @@ -31,6 +31,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Endre katalogen (Endre bibliografiske poster og eksemplaropplysninger)'), ( 9, 'fast_cataloging', 'Hurtigkatalogisering'), ( 9, 'edit_items', 'Endre eksmeplarer'), + ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEdition preference (please note that edit_item is still required)'), + ( 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, 'vendors_manage', 'Administrere leverandører'), @@ -63,6 +65,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES (13, 'batch_upload_patron_images', 'Laste opp bilder av lånere enkeltvis eller en masse'), (13, 'schedule_tasks', 'Planlegge oppgaver som skal kjøres'), (13, 'items_batchmod', 'Utføre masseendringer av eksemplarer'), + (13, 'items_batchmod_restricted', 'Limit batch item modification to subfields defined in the SubfieldsToAllowForRestrictedBatchmod preference (please note that items_batchmod is still required)'), (13, 'items_batchdel', 'Utføre masseslettinger av eksemplarer'), (13, 'manage_csv_profiles', 'Administrere CSV eksportprofiler'), (13, 'moderate_tags', 'Behandle tagger fra lånere'), diff --git a/installer/data/mysql/pl-PL/mandatory/userpermissions.sql b/installer/data/mysql/pl-PL/mandatory/userpermissions.sql index caf1db8195..32b01bf28a 100644 --- a/installer/data/mysql/pl-PL/mandatory/userpermissions.sql +++ b/installer/data/mysql/pl-PL/mandatory/userpermissions.sql @@ -11,6 +11,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Edit catalogue'), ( 9, 'fast_cataloging', 'Szybkie katalogowanie'), ( 9, 'edit_items', 'Edit Items'), + ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEdition preference (please note that edit_item is still required)'), + ( 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, 'vendors_manage', 'Zarządzanei dostawcami'), @@ -43,6 +45,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES (13, 'batch_upload_patron_images', 'Upload patron images in a batch or one at a time'), (13, 'schedule_tasks', 'Schedule tasks to run'), (13, 'items_batchmod', 'Perform batch modification of items'), + (13, 'items_batchmod_restricted', 'Limit batch item modification to subfields defined in the SubfieldsToAllowForRestrictedBatchmod preference (please note that items_batchmod is still required)'), (13, 'items_batchdel', 'Perform batch deletion of items'), (13, 'manage_csv_profiles', 'Manage CSV export profiles'), (13, 'moderate_tags', 'Moderate patron tags'), diff --git a/installer/data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql b/installer/data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql index 9b9839dd38..a8941cf176 100644 --- a/installer/data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql +++ b/installer/data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql @@ -37,6 +37,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), ( 9, 'fast_cataloging', 'Fast cataloging'), ( 9, 'edit_items', 'Edit Items'), + ( 9, 'edit_items_restricted', 'Limit item modification to barcode, status and note (please note that edit_item is still required)'), + ( 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, 'vendors_manage', 'Manage vendors'), @@ -69,6 +71,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES (13, 'batch_upload_patron_images', 'Загрузка изображений посетителей партиями или всех сразу'), (13, 'schedule_tasks', 'Планирование задач к выполнению'), (13, 'items_batchmod', 'Perform batch modification of items'), + (13, 'items_batchmod_restricted', 'Limit batch item modification to item status (please note that items_batchmod is still required)'), (13, 'items_batchdel', 'Perform batch deletion of items'), (13, 'manage_csv_profiles', 'Manage CSV export profiles'), (13, 'moderate_tags', 'Moderate patron tags'), diff --git a/installer/data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql b/installer/data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql index 40d741fd6f..f8bfd0d1f7 100644 --- a/installer/data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql +++ b/installer/data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql @@ -37,6 +37,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), ( 9, 'fast_cataloging', 'Fast cataloging'), ( 9, 'edit_items', 'Edit Items'), + ( 9, 'edit_items_restricted', 'Limit item modification to barcode, status and note (please note that edit_item is still required)'), + ( 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, 'vendors_manage', 'Manage vendors'), @@ -69,6 +71,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES (13, 'batch_upload_patron_images', 'Завантаження зображень відвідувачів партіями чи усіх за раз'), (13, 'schedule_tasks', 'Планування задач до виконання'), (13, 'items_batchmod', 'Perform batch modification of items'), + (13, 'items_batchmod_restricted', 'Limit batch item modification to item status (please note that items_batchmod is still required)'), (13, 'items_batchdel', 'Perform batch deletion of items'), (13, 'manage_csv_profiles', 'Manage CSV export profiles'), (13, 'moderate_tags', 'Moderate patron tags'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 5ada3859b0..a93aebc4ff 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9438,6 +9438,38 @@ if ( CheckVersion($DBversion) ) { SetVersion ($DBversion); } +$DBversion = "3.17.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do(q{ + INSERT INTO permissions (module_bit, code, description) VALUES ('9', 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEdition preference (please note that edit_item is still required)'); + }); + + $dbh->do(q{ + INSERT INTO permissions (module_bit, code, description) VALUES ('9', 'delete_all_items', 'Delete all items at once'); + }); + + $dbh->do(q{ + INSERT INTO permissions (module_bit, code, description) VALUES ('13', 'items_batchmod_restricted', 'Limit batch item modification to subfields defined in the SubfieldsToAllowForRestrictedBatchmod preferenec (pplease note that items_batchmod is still required)'); + }); + + # The delete_all_items permission should be added to users having the edit_items permission. + $dbh->do(q{ + INSERT INTO user_permissions (borrowernumber, module_bit, code) SELECT borrowernumber, module_bit, "delete_all_items" FROM user_permissions WHERE code="edit_items"; + }); + + # Add 2 new prefs + $dbh->do(q{ + INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SubfieldsToAllowForRestrictedEdition','','Define a list of subfields for which edition is authorized when edit_items_restricted permission is enabled, separated by spaces. Example: 995\$f 995\$h 995\$j','','Free'); + }); + + $dbh->do(q{ + INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SubfieldsToAllowForRestrictedBatchmod','','Define a list of subfields for which edition is authorized when items_batchmod_restricted permission is enabled, separated by spaces. Example: 995\$f 995\$h 995\$j','','Free'); + }); + + print "Upgrade to $DBversion done (Bug 7673: Adds 2 new prefs (SubfieldsToAllowForRestrictedEdition and SubfieldsToAllowForRestrictedBatchmod) and 3 new permissions (edit_items_restricted and delete_all_items and items_batchmod_restricted))\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref index cff02f758e..5f80f4ca06 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -109,6 +109,20 @@ Cataloging: - pref: UNIMARCField100Language class: short - as default language in the UNIMARC field 100 when creating a new record or in the field plugin. + - + - Define a list of subfields for which edition is authorized when edit_items_restricted permission is enabled, separated by spaces. + - pref: SubfieldsToAllowForRestrictedEdition + - 'Examples:' + - 'UNIMARC: "995$f 995$h 995$j"' + - 'MARC21: "952$a 952$b 952$c"' + - Note that the FA framework is excluded from the permission. + - + - Define a list of subfields for which edition is authorized when items_batchmod_restricted permission is enabled, separated by spaces. + - pref: SubfieldsToAllowForRestrictedBatchmod + - 'Examples:' + - 'UNIMARC: "995$f 995$h 995$j"' + - 'MARC21: "952$a 952$b 952$c"' + - Note that the FA framework is excluded from the permission. Display: - - 'Separate multiple displayed authors, series or subjects with ' -- 2.39.5