View | Details | Raw Unified | Return to bug 17663
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug17663.perl (+26 lines)
Line 0 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q|
4
INSERT IGNORE INTO permissions (module_bit, code, description) VALUES
5
    (13, 'upload_general_files', 'Upload any file'),
6
    (13, 'upload_manage', 'Manage uploaded files');
7
    |);
8
9
# Update user_permissions for current users (check count in uploaded_files)
10
# Note 9 == edit_catalogue and 13 == tools
11
# We do not insert if someone is superlibrarian, does not have edit_catalogue,
12
# or already has all tools
13
    $dbh->do(q|
14
INSERT IGNORE INTO user_permissions (borrowernumber, module_bit, code)
15
    SELECT borrowernumber, 13, 'upload_general_files'
16
    FROM borrowers bo
17
    WHERE flags<>1 AND flags & POW(2,13) = 0 AND
18
        ( flags & POW(2,9) > 0 OR (
19
            SELECT COUNT(*) FROM user_permissions
20
            WHERE borrowernumber=bo.borrowernumber AND module_bit=9 ) > 0 )
21
        AND ( SELECT COUNT(*) FROM uploaded_files ) > 0;
22
    |);
23
24
    SetVersion( $DBversion );
25
    print "Upgrade to $DBversion done (Bug 17663 - Forgotten userpermissions)\n";
26
}
(-)a/installer/data/mysql/userpermissions.sql (-1 / +2 lines)
Lines 57-62 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
57
   (13, 'records_batchmod', 'Perform batch modification of records (biblios or authorities)'),
57
   (13, 'records_batchmod', 'Perform batch modification of records (biblios or authorities)'),
58
   (13, 'marc_modification_templates', 'Manage marc modification templates'),
58
   (13, 'marc_modification_templates', 'Manage marc modification templates'),
59
   (13, 'records_batchdel', 'Perform batch deletion of records (bibliographic or authority)'),
59
   (13, 'records_batchdel', 'Perform batch deletion of records (bibliographic or authority)'),
60
   (13, 'upload_general_files', 'Upload any file'),
61
   (13, 'upload_manage', 'Manage uploaded files'),
60
   (15, 'check_expiration', 'Check the expiration of a serial'),
62
   (15, 'check_expiration', 'Check the expiration of a serial'),
61
   (15, 'claim_serials', 'Claim missing serials'),
63
   (15, 'claim_serials', 'Claim missing serials'),
62
   (15, 'create_subscription', 'Create a new subscription'),
64
   (15, 'create_subscription', 'Create a new subscription'),
63
- 

Return to bug 17663