@@ -, +, @@ tools This will allow you to access the tools/upload form via the Tools menu. And it will also allow you to add permanent uploads. It will allow you to delete uploads from other users. Note that anyone may delete his own uploads. It is not meant to include upload_general_files. the Patron/Set permissions page. *only*, verify that this user now also has upload_general_files. --- .../data/mysql/atomicupdate/14686_permissions.sql | 20 ++++++++++++++++++++ .../intranet-tmpl/prog/en/includes/permissions.inc | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/14686_permissions.sql --- a/installer/data/mysql/atomicupdate/14686_permissions.sql +++ a/installer/data/mysql/atomicupdate/14686_permissions.sql @@ -0,0 +1,20 @@ +-- Insert permission +INSERT IGNORE INTO permissions (module_bit, code, description) VALUES + (13, 'upload_general_files', 'Upload any file'), + (13, 'upload_manage', 'Manage uploaded files'); + +-- Update user_permissions for current users (check count in uploaded_files) +-- Note 9 == edit_catalogue and 13 == tools +-- We do not insert if someone is superlibrarian, does not have edit_catalogue, +-- or already has all tools +INSERT IGNORE INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 13, 'upload_general_files' + FROM borrowers bo + WHERE flags<>1 AND flags & POW(2,13) = 0 AND + ( flags & POW(2,9) > 0 OR ( + SELECT COUNT(*) FROM user_permissions + WHERE borrowernumber=bo.borrowernumber AND module_bit=9 ) > 0 ) + AND ( SELECT COUNT(*) FROM uploaded_files ) > 0 + +# Copy-paste for RM use: +# print "Upgrade to $DBversion done (Bug 14686 - New menu option and permission for file uploading)\n"; --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -100,5 +100,7 @@ [%- CASE 'report' -%]Use report plugins [%- CASE 'tool' -%]Use tool plugins [%- CASE 'delete_public_lists' -%]Delete public lists + [%- CASE 'upload_general_files' -%]Upload any file + [%- CASE 'upload_manage' -%]Manage uploaded files (Useless without upload_general_files) [%- END -%] [%- END -%] --