From 53ba2f3ffb7a06511a1fe91a10627008c7a70ed6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 11 Jun 2020 12:48:00 +0200 Subject: [PATCH] Bug 22417: Add the new permission manage_background_jobs QA: Please answer the question in admin/background_jobs.pl Signed-off-by: Tomas Cohen Arazi Signed-off-by: David Cook Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart --- admin/background_jobs.pl | 3 ++- installer/data/mysql/atomicupdate/bug_15032.perl | 6 ++++++ installer/data/mysql/userpermissions.sql | 1 + koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/admin/background_jobs.pl b/admin/background_jobs.pl index 85dd740b40..9e08c70605 100755 --- a/admin/background_jobs.pl +++ b/admin/background_jobs.pl @@ -37,7 +37,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => { parameters => 'manage_background_jobs' }, # TODO Add this new permission, so far only works for superlibrarians + flagsrequired => { parameters => 'manage_background_jobs' }, # Maybe the "view" view should be accessible for the user who create this job. + # But in that case what could the permission to check here? tools => '*' ? debug => 1, } ); diff --git a/installer/data/mysql/atomicupdate/bug_15032.perl b/installer/data/mysql/atomicupdate/bug_15032.perl index 34554fc2f2..1c7eec4dbb 100644 --- a/installer/data/mysql/atomicupdate/bug_15032.perl +++ b/installer/data/mysql/atomicupdate/bug_15032.perl @@ -20,6 +20,12 @@ if( CheckVersion( $DBversion ) ) { |); } + $dbh->do(qq{ + INSERT IGNORE permissions (module_bit, code, description) + VALUES + (3, 'manage_background_jobs', 'Manage background jobs') + }); + SetVersion( $DBversion ); print "Upgrade to $DBversion done (Bug 15032 - Add new table background_jobs)\n"; } diff --git a/installer/data/mysql/userpermissions.sql b/installer/data/mysql/userpermissions.sql index d5cfbf84de..08d6ffebf8 100644 --- a/installer/data/mysql/userpermissions.sql +++ b/installer/data/mysql/userpermissions.sql @@ -35,6 +35,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 3, 'manage_additional_fields', 'Add, edit, or delete additional custom fields for baskets or subscriptions (also requires order_manage or edit_subscription permissions)'), ( 3, 'manage_keyboard_shortcuts', 'Manage keyboard shortcuts for the advanced cataloging editor'), ( 3, 'manage_smtp_servers', 'Manage SMTP servers configuration'), + ( 3, 'manage_background_jobs', 'Manage background jobs'), ( 4, 'edit_borrowers', 'Add, modify and view patron information'), ( 4, 'view_borrower_infos_from_any_libraries', 'View patron infos from any libraries'), ( 6, 'place_holds', 'Place holds for patrons'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index 92fd25a5d2..83f4795613 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -260,6 +260,11 @@ Manage keyboard shortcuts for the advanced cataloging editor ([% name | html %]) + [%- CASE 'manage_background_jobs' -%] + + Manage background jobs + + ([% name | html %]) [%- CASE 'edit_borrowers' -%] Add, modify and view patron information -- 2.39.5