|
Lines 501-507
subtest 'Search by any borrowers field (bug 17374)' => sub {
Link Here
|
| 501 |
}; |
501 |
}; |
| 502 |
|
502 |
|
| 503 |
subtest 'Search with permissions' => sub { |
503 |
subtest 'Search with permissions' => sub { |
| 504 |
plan tests => 2; |
504 |
plan tests => 4; |
| 505 |
|
505 |
|
| 506 |
my $superlibrarian = $builder->build_object( |
506 |
my $superlibrarian = $builder->build_object( |
| 507 |
{ |
507 |
{ |
|
Lines 549-554
subtest 'Search with permissions' => sub {
Link Here
|
| 549 |
], |
549 |
], |
| 550 |
'We got the 3 patrons we expected' |
550 |
'We got the 3 patrons we expected' |
| 551 |
); |
551 |
); |
|
|
552 |
|
| 553 |
C4::Context->dbh->do( |
| 554 |
q|INSERT INTO user_permissions(borrowernumber, module_bit, code) VALUES(?,?,?)|, |
| 555 |
undef, |
| 556 |
$librarian_with_subpermission->borrowernumber, |
| 557 |
13, |
| 558 |
'moderate_comments' |
| 559 |
); |
| 560 |
$search_results = C4::Utils::DataTables::Members::search( |
| 561 |
{ |
| 562 |
searchmember => "", |
| 563 |
searchfieldstype => 'standard', |
| 564 |
searchtype => 'contain', |
| 565 |
branchcode => $branchcode, |
| 566 |
has_permission => { |
| 567 |
permission => 'suggestions', |
| 568 |
subpermission => 'suggestions_manage' |
| 569 |
}, |
| 570 |
dt_params => { iDisplayLength => 3, iDisplayStart => 0 }, |
| 571 |
} |
| 572 |
); |
| 573 |
is( $search_results->{iTotalDisplayRecords}, |
| 574 |
3, "We find 3 patrons with suggestions_manage permission" ); |
| 575 |
is_deeply( |
| 576 |
[ sort map { $_->{borrowernumber} } @{ $search_results->{patrons} } ], |
| 577 |
[ |
| 578 |
$superlibrarian->borrowernumber, |
| 579 |
$librarian_with_full_permission->borrowernumber, |
| 580 |
$librarian_with_subpermission->borrowernumber |
| 581 |
], |
| 582 |
'We got the 3 patrons we expected' |
| 583 |
); |
| 584 |
|
| 552 |
}; |
585 |
}; |
| 553 |
|
586 |
|
| 554 |
subtest 'return values' => sub { |
587 |
subtest 'return values' => sub { |
| 555 |
- |
|
|