From a3f98c8c7cfbbac13622597f466d5d6503d3544b Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 2 Oct 2019 13:28:39 +0000 Subject: [PATCH] Bug 17268: Add macros table and permissions --- .../atomicupdate/bug_17268_add_macros_table.perl | 27 ++++++++++++++++++++++ installer/data/mysql/userpermissions.sql | 2 ++ .../intranet-tmpl/prog/en/includes/permissions.inc | 10 ++++++++ 3 files changed, 39 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_17268_add_macros_table.perl diff --git a/installer/data/mysql/atomicupdate/bug_17268_add_macros_table.perl b/installer/data/mysql/atomicupdate/bug_17268_add_macros_table.perl new file mode 100644 index 0000000000..aa79ac595d --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_17268_add_macros_table.perl @@ -0,0 +1,27 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + unless ( TableExists('advanced_editor_macros') ) { + $dbh->do(q| + CREATE TABLE advanced_editor_macros ( + id INT(11) NOT NULL AUTO_INCREMENT, + name varchar(80) NOT NULL, + macro longtext NULL, + borrowernumber INT(11) default NULL, + public BIT default 0, + PRIMARY KEY (id), + CONSTRAINT borrower_macro_fk FOREIGN KEY ( borrowernumber ) REFERENCES borrowers ( borrowernumber ) ON UPDATE CASCADE ON DELETE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;| + ); + } + $dbh->do(q| + INSERT IGNORE INTO permissions (module_bit, code, description) + VALUES (9, 'create_public_macros', 'Create public macros') + |); + $dbh->do(q| + INSERT IGNORE INTO permissions (module_bit, code, description) + VALUES (9, 'delete_public_macros', 'Delete public macros') + |); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 17682 - Add macros db table and permissions)\n"; +} diff --git a/installer/data/mysql/userpermissions.sql b/installer/data/mysql/userpermissions.sql index d9caa0e454..e87222fbd1 100644 --- a/installer/data/mysql/userpermissions.sql +++ b/installer/data/mysql/userpermissions.sql @@ -39,6 +39,8 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 9, 'edit_catalogue', 'Edit catalog (Modify bibliographic/holdings data)'), ( 9, 'fast_cataloging', 'Fast cataloging'), ( 9, 'advanced_editor', 'Use the advanced cataloging editor (requires edit_catalogue)'), + ( 9, 'create_public_macros', 'Create public macros'), + ( 9, 'delete_public_macros', 'Delete public macros'), ( 9, 'edit_items', 'Edit items'), ( 9, 'edit_items_restricted', 'Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEditing preference (please note that edit_item is still required)'), ( 9, 'delete_all_items', 'Delete all items at once'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index e3faeddbba..0b2042841d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -279,6 +279,16 @@ Use the advanced cataloging editor (requires edit_catalogue) ([% name | html %]) + [%- CASE 'create_public_macros' -%] + + Create public macros (requires advanced_editor) + + ([% name | html %]) + [%- CASE 'delete_public_macros' -%] + + Delete public macros (requires advanced_editor) + + ([% name | html %]) [%- CASE 'edit_items' -%] Edit items -- 2.11.0