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

(-)a/t/db_dependent/Auth/haspermission.t (-12 / +18 lines)
Lines 20-26 Link Here
20
# along with Koha; if not, see <http://www.gnu.org/licenses>.
20
# along with Koha; if not, see <http://www.gnu.org/licenses>.
21
21
22
use Modern::Perl;
22
use Modern::Perl;
23
use Test::More tests => 13;
23
use Test::More tests => 14;
24
24
25
use Koha::Database;
25
use Koha::Database;
26
use t::lib::TestBuilder;
26
use t::lib::TestBuilder;
Lines 53-66 $builder->build({ Link Here
53
        code => 'upload_local_cover_images',
53
        code => 'upload_local_cover_images',
54
    },
54
    },
55
});
55
});
56
$builder->build({
57
    source => 'UserPermission',
58
    value  => {
59
        borrowernumber => $borr2->{borrowernumber},
60
        module_bit => 13, # tools
61
        code => 'batch_upload_patron_images',
62
    },
63
});
64
56
65
# Check top level permission for superlibrarian
57
# Check top level permission for superlibrarian
66
my $r = haspermission( $borr1->{userid},
58
my $r = haspermission( $borr1->{userid},
Lines 99-108 $r = haspermission( $borr2->{userid}, Link Here
99
    { acquisition => 'budget_manage', tools => 'edit_news' } );
91
    { acquisition => 'budget_manage', tools => 'edit_news' } );
100
is( $r, 0, 'Borrower2/two granular should fail' );
92
is( $r, 0, 'Borrower2/two granular should fail' );
101
$r = haspermission( $borr2->{userid}, {
93
$r = haspermission( $borr2->{userid}, {
102
    tools => 'upload_local_cover_images',
94
    tools => ['upload_local_cover_images','batch_upload_patron_images'],
103
    tools => 'batch_upload_patron_images',
95
});
96
97
is( $r, 0, 'Borrower2/tools granular two upload subperms if only has one should fail' );
98
99
$builder->build({
100
    source => 'UserPermission',
101
    value  => {
102
        borrowernumber => $borr2->{borrowernumber},
103
        module_bit => 13, # tools
104
        code => 'batch_upload_patron_images',
105
    },
106
});
107
108
$r = haspermission( $borr2->{userid}, {
109
    tools => ['upload_local_cover_images','batch_upload_patron_images'],
104
});
110
});
105
is( ref($r), 'HASH', 'Borrower2/tools granular two upload subperms' );
111
is( ref($r), 'HASH', 'Borrower2/tools granular two upload subperms' );
106
112
113
107
# End
114
# End
108
$schema->storage->txn_rollback;
115
$schema->storage->txn_rollback;
109
- 

Return to bug 22031