Lines 17-23
return {
Link Here
|
17 |
my $insert_sth = |
17 |
my $insert_sth = |
18 |
$dbh->prepare("INSERT IGNORE INTO user_permissions (borrowernumber, module_bit, code) VALUES (?, ?, ?)"); |
18 |
$dbh->prepare("INSERT IGNORE INTO user_permissions (borrowernumber, module_bit, code) VALUES (?, ?, ?)"); |
19 |
|
19 |
|
20 |
# Check for 'borrowers' or 'borrowers > edit_borrowers' permission |
20 |
# Check for 'borrowers > edit_borrowers' permission |
21 |
my $sth2 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'edit_borrowers'"); |
21 |
my $sth2 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'edit_borrowers'"); |
22 |
$sth2->execute(); |
22 |
$sth2->execute(); |
23 |
my @edit_borrowers = map { $_->[0] } @{ $sth2->fetchall_arrayref }; |
23 |
my @edit_borrowers = map { $_->[0] } @{ $sth2->fetchall_arrayref }; |
Lines 30-36
return {
Link Here
|
30 |
my $sth3 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'manage_bookings'"); |
30 |
my $sth3 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'manage_bookings'"); |
31 |
$sth3->execute(); |
31 |
$sth3->execute(); |
32 |
my @manage_bookings = map { $_->[0] } @{ $sth3->fetchall_arrayref }; |
32 |
my @manage_bookings = map { $_->[0] } @{ $sth3->fetchall_arrayref }; |
33 |
@rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @manage_bookings, @exclusions ) ); |
33 |
my $sth3_1 = $dbh->prepare("SELECT borrowernumber FROM borrowers WHERE flags & (1<<1)"); |
|
|
34 |
$sth3_1->execute(); |
35 |
my @circulate = map { $_->[0] } @{ $sth3_1->fetchall_arrayref }; |
36 |
my @bookings = (@manage_bookings, @circulate); |
37 |
@rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @bookings, @exclusions ) ); |
34 |
foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); } |
38 |
foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); } |
35 |
say $out "list_borrowers added to all users with manage_bookings"; |
39 |
say $out "list_borrowers added to all users with manage_bookings"; |
36 |
|
40 |
|
Lines 38-44
return {
Link Here
|
38 |
my $sth4 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'label_creator'"); |
42 |
my $sth4 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'label_creator'"); |
39 |
$sth4->execute(); |
43 |
$sth4->execute(); |
40 |
my @label_creator = map { $_->[0] } @{ $sth4->fetchall_arrayref }; |
44 |
my @label_creator = map { $_->[0] } @{ $sth4->fetchall_arrayref }; |
41 |
@rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @label_creator, @exclusions ) ); |
45 |
my $sth4_1 = $dbh->prepare("SELECT borrowernumber FROM borrowers WHERE flags & (1<<13)"); |
|
|
46 |
$sth4_1->execute(); |
47 |
my @tools = map { $_->[0] } @{ $sth4_1->fetchall_arrayref }; |
48 |
my @labels = (@label_creator, @tools); |
49 |
@rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @labels, @exclusions ) ); |
42 |
foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); } |
50 |
foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); } |
43 |
say $out "list_borrowers added to all users with label_creator"; |
51 |
say $out "list_borrowers added to all users with label_creator"; |
44 |
|
52 |
|
Lines 46-52
return {
Link Here
|
46 |
my $sth5 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'routing'"); |
54 |
my $sth5 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'routing'"); |
47 |
$sth5->execute(); |
55 |
$sth5->execute(); |
48 |
my @routing = map { $_->[0] } @{ $sth5->fetchall_arrayref }; |
56 |
my @routing = map { $_->[0] } @{ $sth5->fetchall_arrayref }; |
49 |
@rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @routing, @exclusions ) ); |
57 |
my $sth5_1 = $dbh->prepare("SELECT borrowernumber FROM borrowers WHERE flags & (1<<15)"); |
|
|
58 |
$sth5_1->execute(); |
59 |
my @serials = map { $_->[0] } @{ $sth5_1->fetchall_arrayref }; |
60 |
my @routing_lists = (@routing, @serials); |
61 |
@rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @routing_lists, @exclusions ) ); |
50 |
foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); } |
62 |
foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); } |
51 |
say $out "list_borrowers added to all users with routing"; |
63 |
say $out "list_borrowers added to all users with routing"; |
52 |
|
64 |
|
Lines 54-60
return {
Link Here
|
54 |
my $sth6 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'order_manage'"); |
66 |
my $sth6 = $dbh->prepare("SELECT borrowernumber FROM user_permissions WHERE code = 'order_manage'"); |
55 |
$sth6->execute(); |
67 |
$sth6->execute(); |
56 |
my @order_manage = map { $_->[0] } @{ $sth6->fetchall_arrayref }; |
68 |
my @order_manage = map { $_->[0] } @{ $sth6->fetchall_arrayref }; |
57 |
@rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @order_manage, @exclusions ) ); |
69 |
my $sth6_1 = $dbh->prepare("SELECT borrowernumber FROM borrowers WHERE flags & (1<<11)"); |
|
|
70 |
$sth6_1->execute(); |
71 |
my @acquisitions = map { $_->[0] } @{ $sth6_1->fetchall_arrayref }; |
72 |
my @orders = (@order_manage, @acquisitions); |
73 |
@rows_to_insert = ( map { [ $_, 4, "list_borrowers" ] } array_minus( @orders, @exclusions ) ); |
58 |
foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); } |
74 |
foreach my $row (@rows_to_insert) { $insert_sth->execute( @{$row} ); } |
59 |
say $out "list_borrowers added to all users with order_manage"; |
75 |
say $out "list_borrowers added to all users with order_manage"; |
60 |
}, |
76 |
}, |
61 |
- |
|
|