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

(-)a/t/db_dependent/Koha/Patron.t (+42 lines)
Lines 924-929 subtest 'can_patron_change_staff_only_lists() tests' => sub { Link Here
924
    $schema->storage->txn_rollback;
924
    $schema->storage->txn_rollback;
925
};
925
};
926
926
927
subtest 'can_patron_change_permitted_staff_lists() tests' => sub {
928
929
    plan tests => 4;
930
931
    $schema->storage->txn_begin;
932
933
    # make a user with no special permissions
934
    my $patron = $builder->build_object(
935
        {
936
            class => 'Koha::Patrons',
937
            value => {
938
                flags => undef
939
            }
940
        }
941
    );
942
    is( $patron->can_patron_change_permitted_staff_lists(), 0, 'Patron without permissions cannot change permitted staff lists');
943
944
    # make it a 'Catalogue' permission
945
    $patron->set({ flags => 4 })->store->discard_changes;
946
    is( $patron->can_patron_change_permitted_staff_lists(), 0, 'Catalogue patron cannot change permitted staff lists');
947
948
    # make it a 'Catalogue' permission and 'edit_public_list_contents' sub-permission
949
    $patron->set({ flags => 4 })->store->discard_changes;
950
    $builder->build(
951
        {
952
            source => 'UserPermission',
953
            value  => {
954
                borrowernumber => $patron->borrowernumber,
955
                module_bit     => 20,                            # lists
956
                code           => 'edit_public_list_contents',
957
            },
958
        }
959
    );
960
    is( $patron->can_patron_change_permitted_staff_lists(), 1, 'Catalogue and "edit_public_list_contents" patron can change permitted staff lists');
961
962
    # make it a superlibrarian
963
    $patron->set({ flags => 1 })->store->discard_changes;
964
    is( $patron->can_patron_change_permitted_staff_lists(), 1, 'Superlibrarian patron can change permitted staff lists');
965
966
    $schema->storage->txn_rollback;
967
};
968
927
subtest 'password expiration tests' => sub {
969
subtest 'password expiration tests' => sub {
928
970
929
    plan tests => 5;
971
    plan tests => 5;
(-)a/t/db_dependent/Virtualshelves.t (-8 / +135 lines)
Lines 22-28 my $dbh = C4::Context->dbh; Link Here
22
teardown();
22
teardown();
23
23
24
subtest 'CRUD' => sub {
24
subtest 'CRUD' => sub {
25
    plan tests => 14;
25
    plan tests => 15;
26
    my $patron = $builder->build({
26
    my $patron = $builder->build({
27
        source => 'Borrower',
27
        source => 'Borrower',
28
    });
28
    });
Lines 45-50 subtest 'CRUD' => sub { Link Here
45
    is( $shelf->allow_change_from_owner, 1, 'The default value for allow_change_from_owner should be 1' );
45
    is( $shelf->allow_change_from_owner, 1, 'The default value for allow_change_from_owner should be 1' );
46
    is( $shelf->allow_change_from_others, 0, 'The default value for allow_change_from_others should be 0' );
46
    is( $shelf->allow_change_from_others, 0, 'The default value for allow_change_from_others should be 0' );
47
    is ( $shelf->allow_change_from_staff, 0, 'The default value for allow_change_from_staff should be 0');
47
    is ( $shelf->allow_change_from_staff, 0, 'The default value for allow_change_from_staff should be 0');
48
    is ( $shelf->allow_change_from_permitted_staff, 0, 'The default value for allow_change_from_permitted_staff should be 0');
48
    is( t::lib::Dates::compare( $shelf->created_on, dt_from_string), 0, 'The creation time should have been set to today' );
49
    is( t::lib::Dates::compare( $shelf->created_on, dt_from_string), 0, 'The creation time should have been set to today' );
49
50
50
    # Test if creation date will not be overwritten by store
51
    # Test if creation date will not be overwritten by store
Lines 172-181 subtest 'Sharing' => sub { Link Here
172
173
173
subtest 'Shelf content' => sub {
174
subtest 'Shelf content' => sub {
174
175
175
    plan tests => 21;
176
    plan tests => 26;
176
    my $patron1 = $builder->build( { source => 'Borrower', } );
177
    my $patron1 = $builder->build( { source => 'Borrower', } );
177
    my $patron2 = $builder->build( { source => 'Borrower', } );
178
    my $patron2 = $builder->build( { source => 'Borrower', } );
178
    my $patron3 = $builder->build( { source => 'Borrower', value => {flags => 1} });
179
    my $patron3 = $builder->build( { source => 'Borrower', value => {flags => 1} });
180
    my $patron4 = $builder->build( { source => 'Borrower', } );
181
    $builder->build(
182
        {
183
            source => 'UserPermission',
184
            value  => {
185
                borrowernumber => $patron4->{borrowernumber},
186
                module_bit     => 20,                            # lists
187
                code           => 'eit_public_list_contents',
188
            },
189
        }
190
    );
179
    my $biblio1 = $builder->build_sample_biblio;
191
    my $biblio1 = $builder->build_sample_biblio;
180
    my $biblio2 = $builder->build_sample_biblio;
192
    my $biblio2 = $builder->build_sample_biblio;
181
    my $biblio3 = $builder->build_sample_biblio;
193
    my $biblio3 = $builder->build_sample_biblio;
Lines 260-291 subtest 'Shelf content' => sub { Link Here
260
    $number_of_contents = Koha::Virtualshelfcontents->search->count;
272
    $number_of_contents = Koha::Virtualshelfcontents->search->count;
261
    is( $number_of_contents, 3, 'Back to three entries' );
273
    is( $number_of_contents, 3, 'Back to three entries' );
262
274
275
    # allow_change_from_permitted_staff == 1 and allow_change_from_staff = 1 and allow_change_from_others == 0
276
    $shelf->allow_change_from_permitted_staff( 1 );
277
    $shelf->allow_change_from_staff( 0 );
278
    $shelf->allow_change_from_others( 1 );
279
    $content4 = $shelf->add_biblio( $biblio3->biblionumber, $patron3->{borrowernumber} );
280
    $number_of_contents = Koha::Virtualshelfcontents->search->count;
281
    is( $number_of_contents, 4, 'The biblio should have been added to the shelf by patron 3');
282
    $number_of_deleted_biblios = $shelf->remove_biblios( { biblionumbers => [ $biblio3->biblionumber ], borrowernumber => $patron3->{borrowernumber} } );
283
    is( $number_of_deleted_biblios, 1, 'Biblio 3 deleted by patron 3' );
284
    $number_of_contents = Koha::Virtualshelfcontents->search->count;
285
    is( $number_of_contents, 3, 'Back to three entries' );
286
287
    $content4 = $shelf->add_biblio( $biblio3->biblionumber, $patron4->{borrowernumber} );
288
    $number_of_contents = Koha::Virtualshelfcontents->search->count;
289
    is( $number_of_contents, 4, 'The biblio should have been added to the shelf by patron 4');
290
    $number_of_deleted_biblios = $shelf->remove_biblios( { biblionumbers => [ $biblio3->biblionumber ], borrowernumber => $patron4->{borrowernumber} } );
291
    $number_of_contents = Koha::Virtualshelfcontents->search->count;
292
    is( $number_of_contents, 3, 'Back to three entries' );
293
263
    teardown();
294
    teardown();
264
};
295
};
265
296
266
subtest 'Shelf permissions' => sub {
297
subtest 'Shelf permissions' => sub {
267
298
268
    plan tests => 100;
299
    plan tests => 175;
269
    my $patron1 = $builder->build( { source => 'Borrower', value => { flags => '2096766' } } ); # 2096766 is everything checked but not superlibrarian
300
    my $patron1 = $builder->build( { source => 'Borrower', value => { flags => '2096766' } } ); # 2096766 is everything checked but not superlibrarian
270
    my $patron2 = $builder->build( { source => 'Borrower', value => { flags => '1048190' } } ); # 1048190 is everything checked but not superlibrarian and delete_public_lists
301
    my $patron2 = $builder->build( { source => 'Borrower', value => { flags => '1048190' } } ); # 1048190 is everything checked but not superlibrarian and delete_public_lists
271
    my $patron3 = $builder->build( { source => 'Borrower', value => { flags => '0' } } ); # this is a patron with no special permissions
302
    my $patron3 = $builder->build( { source => 'Borrower', value => { flags => '0' } } ); # this is a patron with no special permissions
272
    my $patron4 = $builder->build( { source => 'Borrower', value => { flags => '0' } } );
303
    my $patron4 = $builder->build( { source => 'Borrower', value => { flags => '0' } } );
304
    my $patron5 = $builder->build( { source => 'Borrower', value => { flags => '4' } } );
273
    my $sth = $dbh->prepare("INSERT INTO user_permissions (borrowernumber, module_bit, code) VALUES (?,?,?)");
305
    my $sth = $dbh->prepare("INSERT INTO user_permissions (borrowernumber, module_bit, code) VALUES (?,?,?)");
274
    $sth->execute($patron4->{borrowernumber}, 20, 'edit_public_lists'); # $patron4 only has the edit_public_lists sub-permission checked
306
    $sth->execute($patron4->{borrowernumber}, 20, 'edit_public_lists'); # $patron4 only has the edit_public_lists sub-permission checked
307
    $sth->execute($patron5->{borrowernumber}, 20, 'edit_public_list_contents'); # $patron5 has the 'catalogue' permission and edit_public_list_contents sub-permission checked
275
308
276
    my $biblio1 = $builder->build_sample_biblio;
309
    my $biblio1 = $builder->build_sample_biblio;
277
    my $biblio2 = $builder->build_sample_biblio;
310
    my $biblio2 = $builder->build_sample_biblio;
278
    my $biblio3 = $builder->build_sample_biblio;
311
    my $biblio3 = $builder->build_sample_biblio;
279
    my $biblio4 = $builder->build_sample_biblio;
312
    my $biblio4 = $builder->build_sample_biblio;
280
    my $biblio5 = $builder->build_sample_biblio;
313
    my $biblio5 = $builder->build_sample_biblio;
314
    my $biblio6 = $builder->build_sample_biblio;
281
315
282
    my $public_shelf = Koha::Virtualshelf->new(
316
    my $public_shelf = Koha::Virtualshelf->new(
283
        {   shelfname    => "my first shelf",
317
        {   shelfname    => "my first shelf",
284
            owner        => $patron1->{borrowernumber},
318
            owner        => $patron1->{borrowernumber},
285
            public       => 1,
319
            public       => 1,
286
            allow_change_from_owner => 0,
320
            allow_change_from_owner           => 0,
287
            allow_change_from_others => 0,
321
            allow_change_from_others          => 0,
288
            allow_change_from_staff => 0,
322
            allow_change_from_staff           => 0,
323
            allow_change_from_permitted_staff => 0
289
        }
324
        }
290
    )->store;
325
    )->store;
291
326
Lines 293-318 subtest 'Shelf permissions' => sub { Link Here
293
    is( $public_shelf->can_be_viewed( $patron2->{borrowernumber} ), 1, 'Public list should be viewed by another staff member');
328
    is( $public_shelf->can_be_viewed( $patron2->{borrowernumber} ), 1, 'Public list should be viewed by another staff member');
294
    is( $public_shelf->can_be_viewed( $patron3->{borrowernumber} ), 1, 'Public list should be viewed by someone with no special permissions' );
329
    is( $public_shelf->can_be_viewed( $patron3->{borrowernumber} ), 1, 'Public list should be viewed by someone with no special permissions' );
295
    is( $public_shelf->can_be_viewed( $patron4->{borrowernumber} ), 1, 'Public list should be viewed by someone with the edit_public_lists sub-permission checked' );
330
    is( $public_shelf->can_be_viewed( $patron4->{borrowernumber} ), 1, 'Public list should be viewed by someone with the edit_public_lists sub-permission checked' );
331
    is( $public_shelf->can_be_viewed( $patron5->{borrowernumber} ), 1, 'Public list should be viewed by someone with the edit_public_list_contents sub-permission checked' );
296
332
297
    is( $public_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' );
333
    is( $public_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' );
298
    is( $public_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Public list should not be deleted by another staff member' );
334
    is( $public_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Public list should not be deleted by another staff member' );
299
    is( $public_shelf->can_be_deleted( $patron3->{borrowernumber} ), 0, 'Public list should not be deleted by someone with no special permissions' );
335
    is( $public_shelf->can_be_deleted( $patron3->{borrowernumber} ), 0, 'Public list should not be deleted by someone with no special permissions' );
300
    is( $public_shelf->can_be_deleted( $patron4->{borrowernumber} ), 0, 'Public list should not be deleted by someone with the edit_public_lists sub-permission checked' );
336
    is( $public_shelf->can_be_deleted( $patron4->{borrowernumber} ), 0, 'Public list should not be deleted by someone with the edit_public_lists sub-permission checked' );
337
    is( $public_shelf->can_be_deleted( $patron5->{borrowernumber} ), 0, 'Public list should not be deleted by someone with the edit_public_list_contents sub-permission checked' );
301
338
302
    is( $public_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage their list' );
339
    is( $public_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage their list' );
303
    is( $public_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Public list should not be managed by another staff member' );
340
    is( $public_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Public list should not be managed by another staff member' );
304
    is( $public_shelf->can_be_managed( $patron3->{borrowernumber} ), 0, 'Public list should not be managed by someone with no special permissions' );
341
    is( $public_shelf->can_be_managed( $patron3->{borrowernumber} ), 0, 'Public list should not be managed by someone with no special permissions' );
305
    is( $public_shelf->can_be_managed( $patron4->{borrowernumber} ), 1, 'Public list should be managed by someone with the edit_public_lists sub-permission checked' );
342
    is( $public_shelf->can_be_managed( $patron4->{borrowernumber} ), 1, 'Public list should be managed by someone with the edit_public_lists sub-permission checked' );
343
    is( $public_shelf->can_be_managed( $patron5->{borrowernumber} ), 0, 'Public list should be managed by someone with the edit_public_list_contents sub-permission checked' );
306
344
307
    is( $public_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 0, 'The owner should not be able to add biblios to their list' );
345
    is( $public_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 0, 'The owner should not be able to add biblios to their list' );
308
    is( $public_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 0, 'Public list should not be modified (add) by another staff member' );
346
    is( $public_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 0, 'Public list should not be modified (add) by another staff member' );
309
    is( $public_shelf->can_biblios_be_added( $patron3->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone with no special permissions' );
347
    is( $public_shelf->can_biblios_be_added( $patron3->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone with no special permissions' );
310
    is( $public_shelf->can_biblios_be_added( $patron4->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone with the edit_public_lists sub-permission checked' );
348
    is( $public_shelf->can_biblios_be_added( $patron4->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone with the edit_public_lists sub-permission checked' );
349
    is( $public_shelf->can_biblios_be_added( $patron5->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone with the edit_public_list_contents sub-permission checked' );
311
350
312
    is( $public_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 0, 'The owner should not be able to remove biblios to their list' );
351
    is( $public_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 0, 'The owner should not be able to remove biblios to their list' );
313
    is( $public_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 0, 'Public list should not be modified (remove) by another staff member' );
352
    is( $public_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 0, 'Public list should not be modified (remove) by another staff member' );
314
    is ( $public_shelf->can_biblios_be_removed( $patron3->{borrowernumber} ), 0, 'Public list should not be modified (removed) by someone with no special permissions' );
353
    is ( $public_shelf->can_biblios_be_removed( $patron3->{borrowernumber} ), 0, 'Public list should not be modified (removed) by someone with no special permissions' );
315
    is( $public_shelf->can_biblios_be_removed( $patron4->{borrowernumber} ), 0, 'Public list should not be modified (removed) by someone with the edit_public_lists sub-permission checked' );
354
    is( $public_shelf->can_biblios_be_removed( $patron4->{borrowernumber} ), 0, 'Public list should not be modified (removed) by someone with the edit_public_lists sub-permission checked' );
355
    is( $public_shelf->can_biblios_be_removed( $patron5->{borrowernumber} ), 0, 'Public list should not be modified (removed) by someone with the edit_public_list_contents sub-permission checked' );
316
356
317
    $public_shelf->allow_change_from_owner(1);
357
    $public_shelf->allow_change_from_owner(1);
318
    $public_shelf->store;
358
    $public_shelf->store;
Lines 321-346 subtest 'Shelf permissions' => sub { Link Here
321
    is( $public_shelf->can_be_viewed( $patron2->{borrowernumber} ), 1, 'Public list should be viewed by staff member' );
361
    is( $public_shelf->can_be_viewed( $patron2->{borrowernumber} ), 1, 'Public list should be viewed by staff member' );
322
    is( $public_shelf->can_be_viewed( $patron3->{borrowernumber} ), 1, 'Public list should be viewed by someone with no special permissions' );
362
    is( $public_shelf->can_be_viewed( $patron3->{borrowernumber} ), 1, 'Public list should be viewed by someone with no special permissions' );
323
    is( $public_shelf->can_be_viewed( $patron4->{borrowernumber} ), 1, 'Public list should be viewable by someone with the edit_public_lists sub-permission checked' );
363
    is( $public_shelf->can_be_viewed( $patron4->{borrowernumber} ), 1, 'Public list should be viewable by someone with the edit_public_lists sub-permission checked' );
364
    is( $public_shelf->can_be_viewed( $patron5->{borrowenumber} ), 1, 'Public list should be viewable by someone with the edit_public_list_contents sub-permission checked' );
324
365
325
    is( $public_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' );
366
    is( $public_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' );
326
    is( $public_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Public list should not be deleted by another staff member' );
367
    is( $public_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Public list should not be deleted by another staff member' );
327
    is( $public_shelf->can_be_deleted( $patron3->{borrowernumber} ), 0, 'Public list should not be deleted by someone with no special permissions' );
368
    is( $public_shelf->can_be_deleted( $patron3->{borrowernumber} ), 0, 'Public list should not be deleted by someone with no special permissions' );
328
    is( $public_shelf->can_be_deleted( $patron4->{borrowernumber} ), 0, 'Public list should not be deleted by someone with the edit_public_lists sub-permission checked' );
369
    is( $public_shelf->can_be_deleted( $patron4->{borrowernumber} ), 0, 'Public list should not be deleted by someone with the edit_public_lists sub-permission checked' );
370
    is( $public_shelf->can_be_deleted( $patron5->{borrowernumber} ), 0, 'Public list should not be deleted by someome with the edit_public_list_contents sub-permission checked' );
329
371
330
    is( $public_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage their list' );
372
    is( $public_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage their list' );
331
    is( $public_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Public list should not be managed by another staff member' );
373
    is( $public_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Public list should not be managed by another staff member' );
332
    is( $public_shelf->can_be_managed( $patron3->{borrowernumber} ), 0, 'Public list should not be managed by someone with no special permissions' );
374
    is( $public_shelf->can_be_managed( $patron3->{borrowernumber} ), 0, 'Public list should not be managed by someone with no special permissions' );
333
    is( $public_shelf->can_be_managed( $patron4->{borrowernumber} ), 1, 'Public list should be managed by someone with the edit_public_lists sub-permission checked' );
375
    is( $public_shelf->can_be_managed( $patron4->{borrowernumber} ), 1, 'Public list should be managed by someone with the edit_public_lists sub-permission checked' );
376
    is( $public_shelf->can_be_managed( $patron5->{borrowernumber} ), 0, 'Public list should be managed by someone with the edit_public_list_contents sub-permission checked' );
334
377
335
    is( $public_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 1, 'The owner should be able to add biblios to their list' );
378
    is( $public_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 1, 'The owner should be able to add biblios to their list' );
336
    is( $public_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 0, 'Public list should not be modified (add) by another staff member' );
379
    is( $public_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 0, 'Public list should not be modified (add) by another staff member' );
337
    is( $public_shelf->can_biblios_be_added( $patron3->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone with no special permissions' );
380
    is( $public_shelf->can_biblios_be_added( $patron3->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone with no special permissions' );
338
    is( $public_shelf->can_biblios_be_added( $patron4->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone with the edit_public_lists sub-permission checked' );
381
    is( $public_shelf->can_biblios_be_added( $patron4->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone with the edit_public_lists sub-permission checked' );
382
    is( $public_shelf->can_biblios_be_added( $patron5->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone with the edit_public_list_contents sub-permission checked' );
339
383
340
    is( $public_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 1, 'The owner should be able to remove biblios to their list' );
384
    is( $public_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 1, 'The owner should be able to remove biblios to their list' );
341
    is( $public_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 0, 'Public list should not be modified (remove) by another staff member' );
385
    is( $public_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 0, 'Public list should not be modified (remove) by another staff member' );
342
    is( $public_shelf->can_biblios_be_removed( $patron3->{borrowernumber} ), 0, 'Public list should not be modified (remove) by someone with no special permissions' );
386
    is( $public_shelf->can_biblios_be_removed( $patron3->{borrowernumber} ), 0, 'Public list should not be modified (remove) by someone with no special permissions' );
343
    is( $public_shelf->can_biblios_be_removed( $patron4->{borrowernumber} ), 0, 'Public list should not be modified (remove) by someone with the edit_public_list sub-permission checked' );
387
    is( $public_shelf->can_biblios_be_removed( $patron4->{borrowernumber} ), 0, 'Public list should not be modified (remove) by someone with the edit_public_list sub-permission checked' );
388
    is( $public_shelf->can_biblios_be_removed( $patron5->{borrowernumber} ), 0, 'Public list should not be modified (remove) by someome with the edit_public_list_contents sub-permission checked' );
389
390
    $public_shelf->allow_change_from_staff(1);
391
    $public_shelf->store;
392
393
    is( $public_shelf->can_be_viewed( $patron1->{borrowernumber} ), 1, 'The owner should be able to view their public list' );
394
    is( $public_shelf->can_be_viewed( $patron2->{borrowernumber} ), 1, 'Public list should be viewed by staff member' );
395
    is( $public_shelf->can_be_viewed( $patron3->{borrowernumber} ), 1, 'Public list should be viewed by someone with no special permissions' );
396
    is( $public_shelf->can_be_viewed( $patron4->{borrowernumber} ), 1, 'Public list should be viewable by someone with the edit_public_lists sub-permission checked' );
397
    is( $public_shelf->can_be_viewed( $patron5->{borrowernumber} ), 1, 'Public list should be viewable by someone with the edit_public_list_contents sub-permission checked' );
398
399
    is( $public_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' );
400
    is( $public_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Public list should not be deleted by another staff member' );
401
    is( $public_shelf->can_be_deleted( $patron3->{borrowernumber} ), 0, 'Public list should not be deleted by someone with no special permissions' );
402
    is( $public_shelf->can_be_deleted( $patron4->{borrowernumber} ), 0, 'Public list should not be deleted by someone with the edit_public_lists sub-permission checked' );
403
    is( $public_shelf->can_be_deleted( $patron5->{borrowernumber} ), 0, 'Public list should not be deleted by someone with the edit_public_list_contents sub-permission checked' );
404
405
    is( $public_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage their list' );
406
    is( $public_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Public list should not be managed by another staff member' );
407
    is( $public_shelf->can_be_managed( $patron3->{borrowernumber} ), 0, 'Public list should not be managed by someone with no special permissions' );
408
    is( $public_shelf->can_be_managed( $patron4->{borrowernumber} ), 1, 'Public list should be managed by someone with the edit_public_lists sub-permission checked' );
409
    is( $public_shelf->can_be_managed( $patron5->{borrowernumber} ), 0, 'Public list should be managed by someone with the edit_public_list_contents sub-permission checked' );
410
411
    is( $public_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 1, 'The owner should be able to add biblios to their list' );
412
    is( $public_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 1, 'Public list should not be modified (add) by another staff member' );
413
    is( $public_shelf->can_biblios_be_added( $patron3->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone with no special permissions' );
414
    is( $public_shelf->can_biblios_be_added( $patron4->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone with the edit_public_lists sub-permission checked' );
415
    is( $public_shelf->can_biblios_be_added( $patron5->{borrowernumber} ), 1, 'Public list should be modified (add) by someone with the edit_public_list_contents sub-permission checked' );
416
417
    is( $public_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 1, 'The owner should be able to remove biblios to their list' );
418
    is( $public_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 1, 'Public list should not be modified (remove) by another staff member' );
419
    is( $public_shelf->can_biblios_be_removed( $patron3->{borrowernumber} ), 0, 'Public list should not be modified (remove) by someone with no special permissions' );
420
    is( $public_shelf->can_biblios_be_removed( $patron4->{borrowernumber} ), 0, 'Public list should not be modified (remove) by someone with the edit_public_list sub-permission checked' );
421
    is( $public_shelf->can_biblios_be_removed( $patron5->{borrowernumber} ), 1, 'Public list should be modified (remove) by someone with the edit_public_list_contents sub-permission checked' );
422
423
    $public_shelf->allow_change_from_permitted_staff(1);
424
    $public_shelf->store;
425
426
    is( $public_shelf->can_be_viewed( $patron1->{borrowernumber} ), 1, 'The owner should be able to view their public list' );
427
    is( $public_shelf->can_be_viewed( $patron2->{borrowernumber} ), 1, 'Public list should be viewed by staff member' );
428
    is( $public_shelf->can_be_viewed( $patron3->{borrowernumber} ), 1, 'Public list should be viewed by someone with no special permissions' );
429
    is( $public_shelf->can_be_viewed( $patron4->{borrowernumber} ), 1, 'Public list should be viewable by someone with the edit_public_lists sub-permission checked' );
430
    is( $public_shelf->can_be_viewed( $patron5->{borrowernumber} ), 1, 'Public list should be viewable by someone with the edit_public_list_contents sub-permission checked' );
431
432
    is( $public_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' );
433
    is( $public_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Public list should not be deleted by another staff member' );
434
    is( $public_shelf->can_be_deleted( $patron3->{borrowernumber} ), 0, 'Public list should not be deleted by someone with no special permissions' );
435
    is( $public_shelf->can_be_deleted( $patron4->{borrowernumber} ), 0, 'Public list should not be deleted by someone with the edit_public_lists sub-permission checked' );
436
    is( $public_shelf->can_be_deleted( $patron5->{borrowernumber} ), 0, 'Public list should not be deleted by someone with the edit_public_list_contents sub-permission checked' );
437
438
    is( $public_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage their list' );
439
    is( $public_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Public list should not be managed by another staff member' );
440
    is( $public_shelf->can_be_managed( $patron3->{borrowernumber} ), 0, 'Public list should not be managed by someone with no special permissions' );
441
    is( $public_shelf->can_be_managed( $patron4->{borrowernumber} ), 1, 'Public list should be managed by someone with the edit_public_lists sub-permission checked' );
442
    is( $public_shelf->can_be_managed( $patron5->{borrowernumber} ), 0, 'Public list should be managed by someone with the edit_public_list_contents sub-permission checked' );
443
444
    is( $public_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 1, 'The owner should be able to add biblios to their list' );
445
    is( $public_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 1, 'Public list should be modified (add) by another staff member' );
446
    is( $public_shelf->can_biblios_be_added( $patron3->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone with no special permissions' );
447
    is( $public_shelf->can_biblios_be_added( $patron4->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone with the edit_public_lists sub-permission checked' );
448
    is( $public_shelf->can_biblios_be_added( $patron5->{borrowernumber} ), 1, 'Public list should not be modified (add) by someone with the edit_public_list_contents sub-permission checked' );
449
450
    is( $public_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 1, 'The owner should be able to remove biblios to their list' );
451
    is( $public_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 1, 'Public list should be modified (remove) by another staff member' );
452
    is( $public_shelf->can_biblios_be_removed( $patron3->{borrowernumber} ), 0, 'Public list should not be modified (remove) by someone with no special permissions' );
453
    is( $public_shelf->can_biblios_be_removed( $patron4->{borrowernumber} ), 0, 'Public list should not be modified (remove) by someone with the edit_public_list sub-permission checked' );
454
    is( $public_shelf->can_biblios_be_removed( $patron5->{borrowernumber} ), 1, 'Public list should be modified (remove) by someone with the edit_public_list_contents sub-permission checked' );
344
455
345
    my $private_shelf = Koha::Virtualshelf->new(
456
    my $private_shelf = Koha::Virtualshelf->new(
346
        {   shelfname    => "my first shelf",
457
        {   shelfname    => "my first shelf",
Lines 349-354 subtest 'Shelf permissions' => sub { Link Here
349
            allow_change_from_owner => 0,
460
            allow_change_from_owner => 0,
350
            allow_change_from_others => 0,
461
            allow_change_from_others => 0,
351
            allow_change_from_staff => 0,
462
            allow_change_from_staff => 0,
463
            allow_change_from_permitted_staff => 0
352
        }
464
        }
353
    )->store;
465
    )->store;
354
466
Lines 356-410 subtest 'Shelf permissions' => sub { Link Here
356
    is( $private_shelf->can_be_viewed( $patron2->{borrowernumber} ), 0, 'Private list should not be viewed by another staff member' );
468
    is( $private_shelf->can_be_viewed( $patron2->{borrowernumber} ), 0, 'Private list should not be viewed by another staff member' );
357
    is( $private_shelf->can_be_viewed( $patron3->{borrowernumber} ), 0, 'Private list should not be viewed by someone with no special permissions' );
469
    is( $private_shelf->can_be_viewed( $patron3->{borrowernumber} ), 0, 'Private list should not be viewed by someone with no special permissions' );
358
    is( $private_shelf->can_be_viewed( $patron4->{borrowernumber} ), 0, 'Private list should not be viewed by someone with the edit_public_lists sub-permission checked' );
470
    is( $private_shelf->can_be_viewed( $patron4->{borrowernumber} ), 0, 'Private list should not be viewed by someone with the edit_public_lists sub-permission checked' );
471
    is( $private_shelf->can_be_viewed( $patron5->{borrowernumber} ), 0, 'Private list should not be viewed by someone with the edit_public_list_contents sub-permission checked' );
359
472
360
    is( $private_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' );
473
    is( $private_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' );
361
    is( $private_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Private list should not be deleted by another staff member' );
474
    is( $private_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Private list should not be deleted by another staff member' );
362
    is( $private_shelf->can_be_deleted( $patron3->{borrowernumber} ), 0, 'Private list should not be deleted by someone with no special permissions' );
475
    is( $private_shelf->can_be_deleted( $patron3->{borrowernumber} ), 0, 'Private list should not be deleted by someone with no special permissions' );
363
    is( $private_shelf->can_be_deleted( $patron4->{borrowernumber} ), 0, 'Private list should not be deleted by someone with the edit_public_lists sub-permission checked' );
476
    is( $private_shelf->can_be_deleted( $patron4->{borrowernumber} ), 0, 'Private list should not be deleted by someone with the edit_public_lists sub-permission checked' );
477
    is( $private_shelf->can_be_deleted( $patron5->{borrowernumber} ), 0, 'Private list should not be deleted by someome with the edit_public_list_contents sub-permission checked' );
364
478
365
    is( $private_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage their list' );
479
    is( $private_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage their list' );
366
    is( $private_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Private list should not be managed by another staff member' );
480
    is( $private_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Private list should not be managed by another staff member' );
367
    is( $private_shelf->can_be_managed( $patron3->{borrowernumber} ), 0, 'Private list should not be managed by someone with no special permissions' );
481
    is( $private_shelf->can_be_managed( $patron3->{borrowernumber} ), 0, 'Private list should not be managed by someone with no special permissions' );
368
    is( $private_shelf->can_be_managed( $patron4->{borrowernumber} ), 0, 'Private list should not be managed by someone with the edit_public_lists sub-permission checked' );
482
    is( $private_shelf->can_be_managed( $patron4->{borrowernumber} ), 0, 'Private list should not be managed by someone with the edit_public_lists sub-permission checked' );
483
    is( $private_shelf->can_be_managed( $patron5->{borrowernumber} ), 0, 'Private list should not be managed by someone with the edit_public_list_contents sub-permission checked' );
369
484
370
    is( $private_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 0, 'The owner should not be able to add biblios to their list' );
485
    is( $private_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 0, 'The owner should not be able to add biblios to their list' );
371
    is( $private_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 0, 'Private list should not be modified (add) by another staff member' );
486
    is( $private_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 0, 'Private list should not be modified (add) by another staff member' );
372
    is( $private_shelf->can_biblios_be_added( $patron3->{borrowernumber} ), 0, 'Private list should not be modified (add) by someone with no special permissions' );
487
    is( $private_shelf->can_biblios_be_added( $patron3->{borrowernumber} ), 0, 'Private list should not be modified (add) by someone with no special permissions' );
373
    is( $private_shelf->can_biblios_be_added( $patron4->{borrowernumber} ), 0, 'Private list should not be modified (add) by someone with the edit_public_lists sub-permission checked' );
488
    is( $private_shelf->can_biblios_be_added( $patron4->{borrowernumber} ), 0, 'Private list should not be modified (add) by someone with the edit_public_lists sub-permission checked' );
489
    is( $private_shelf->can_biblios_be_added( $patron5->{borrowernumber} ), 0, 'Private list should not be modified (add) by someone with the edit_public_list_contents sub-permission checked' );
374
490
375
    is( $private_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 0, 'The owner should not be able to remove biblios to their list' );
491
    is( $private_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 0, 'The owner should not be able to remove biblios to their list' );
376
    is( $private_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 0, 'Private list should not be modified (remove) by another staff member' );
492
    is( $private_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 0, 'Private list should not be modified (remove) by another staff member' );
377
    is( $private_shelf->can_biblios_be_removed( $patron3->{borrowernumber} ), 0, 'Private list should not be modified (remove) by someone with no special permissions' );
493
    is( $private_shelf->can_biblios_be_removed( $patron3->{borrowernumber} ), 0, 'Private list should not be modified (remove) by someone with no special permissions' );
378
    is( $private_shelf->can_biblios_be_removed( $patron4->{borrowernumber} ), 0, 'Private list should not be modified (remove) by someone with the edit_public_lists sub-permissions' );
494
    is( $private_shelf->can_biblios_be_removed( $patron4->{borrowernumber} ), 0, 'Private list should not be modified (remove) by someone with the edit_public_lists sub-permissions' );
495
    is( $private_shelf->can_biblios_be_removed( $patron5->{borrowernumber} ), 0, 'Private list should not be modified (remove) by someone with the edit_public_list_contents sub-permissions' );
379
496
380
    $private_shelf->allow_change_from_owner(1);
497
    $private_shelf->allow_change_from_owner(1);
381
    $private_shelf->allow_change_from_staff(1);
498
    $private_shelf->allow_change_from_staff(1);
382
    $private_shelf->allow_change_from_others(0);
499
    $private_shelf->allow_change_from_others(0);
500
    $private_shelf->allow_change_from_permitted_staff(0);
383
    $private_shelf->store;
501
    $private_shelf->store;
384
    is( $private_shelf->can_be_viewed( $patron1->{borrowernumber} ), 1, 'The owner should be able to view their list' );
502
    is( $private_shelf->can_be_viewed( $patron1->{borrowernumber} ), 1, 'The owner should be able to view their list' );
385
    is( $private_shelf->can_be_viewed( $patron2->{borrowernumber} ), 0, 'Private list should not be viewed by another staff member' );
503
    is( $private_shelf->can_be_viewed( $patron2->{borrowernumber} ), 0, 'Private list should not be viewed by another staff member' );
386
    is( $private_shelf->can_be_viewed( $patron3->{borrowernumber} ), 0, 'Private list should not be viewed by someone with no special permissions' );
504
    is( $private_shelf->can_be_viewed( $patron3->{borrowernumber} ), 0, 'Private list should not be viewed by someone with no special permissions' );
387
    is( $private_shelf->can_be_viewed( $patron4->{borrowernumber} ), 0, 'Private list should not be viewed by someone with the edit_public_lists sub-permission checked' );
505
    is( $private_shelf->can_be_viewed( $patron4->{borrowernumber} ), 0, 'Private list should not be viewed by someone with the edit_public_lists sub-permission checked' );
506
    is( $private_shelf->can_be_viewed( $patron5->{borrowernumber} ), 0, 'Private list should not be viewed by someone with the edit_public_list_contents sub-permission checked' );
388
507
389
    is( $private_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' );
508
    is( $private_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' );
390
    is( $private_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Private list should not be deleted by another staff member' );
509
    is( $private_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Private list should not be deleted by another staff member' );
391
    is( $private_shelf->can_be_deleted( $patron3->{borrowernumber} ), 0, 'Private list should not be deleted by someone with no special permissions' );
510
    is( $private_shelf->can_be_deleted( $patron3->{borrowernumber} ), 0, 'Private list should not be deleted by someone with no special permissions' );
392
    is( $private_shelf->can_be_deleted( $patron4->{borrowernumber} ), 0, 'Private list should not be deleted by someone with the edit_public_lists sub-permission checked' );
511
    is( $private_shelf->can_be_deleted( $patron4->{borrowernumber} ), 0, 'Private list should not be deleted by someone with the edit_public_lists sub-permission checked' );
512
    is( $private_shelf->can_be_deleted( $patron5->{borrowernumber} ), 0, 'Private list should not be viewed by someone with the edit_public_list_contents sub-permission checked' );
393
513
394
    is( $private_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage their list' );
514
    is( $private_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage their list' );
395
    is( $private_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Private list should not be managed by another staff member' );
515
    is( $private_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Private list should not be managed by another staff member' );
396
    is( $private_shelf->can_be_managed( $patron3->{borrowernumber} ), 0, 'Private list should not be managed by someone with no special permissions' );
516
    is( $private_shelf->can_be_managed( $patron3->{borrowernumber} ), 0, 'Private list should not be managed by someone with no special permissions' );
397
    is( $private_shelf->can_be_managed( $patron4->{borrowernumber} ), 0, 'Private list should not be managed by someone with the edit_public_lists sub-permission checked' );
517
    is( $private_shelf->can_be_managed( $patron4->{borrowernumber} ), 0, 'Private list should not be managed by someone with the edit_public_lists sub-permission checked' );
518
    is( $private_shelf->can_be_managed( $patron5->{borrowernumber} ), 0, 'Private list should not be managed by someone with the edit_public_list_contents sub-permission checked' );
398
519
399
    is( $private_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 1, 'The owner should be able to add biblios to their list' );
520
    is( $private_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 1, 'The owner should be able to add biblios to their list' );
400
    is( $private_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 1, 'Private list should not modified (add) by another staff member # individual check done later' );
521
    is( $private_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 1, 'Private list should be modified (add) by another staff member # individual check done later' );
401
    is( $private_shelf->can_biblios_be_added( $patron3->{borrowernumber} ), 0, 'Private list should not be modified (add) by someone with no special permissions' );
522
    is( $private_shelf->can_biblios_be_added( $patron3->{borrowernumber} ), 0, 'Private list should not be modified (add) by someone with no special permissions' );
402
    is ( $private_shelf->can_biblios_be_added( $patron4->{borrowernumber} ), 0, 'Private list should not be modified (add) by someone with the edit_public_lists sub-permission checked' );
523
    is ( $private_shelf->can_biblios_be_added( $patron4->{borrowernumber} ), 0, 'Private list should not be modified (add) by someone with the edit_public_lists sub-permission checked' );
524
    is( $private_shelf->can_biblios_be_added( $patron5->{borrowernumber} ), 1, 'Private list should be modififed (add) by someone with the edit_public_list_contents sub-permission checked' );
403
525
404
    is( $private_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 1, 'The owner should be able to remove biblios to their list' );
526
    is( $private_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 1, 'The owner should be able to remove biblios to their list' );
405
    is( $private_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 1, 'Private list should be modified (remove) by another staff member # individual check done later' );
527
    is( $private_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 1, 'Private list should be modified (remove) by another staff member # individual check done later' );
406
    is( $private_shelf->can_biblios_be_removed( $patron3->{borrowernumber} ), 0, 'Private list should not be modified (remove) by someone with no special permissions' );
528
    is( $private_shelf->can_biblios_be_removed( $patron3->{borrowernumber} ), 0, 'Private list should not be modified (remove) by someone with no special permissions' );
407
    is( $private_shelf->can_biblios_be_removed( $patron4->{borrowernumber} ), 0, 'Private list should not be modified (remove) by someone with the edit_public_lists sub-permission checked' );
529
    is( $private_shelf->can_biblios_be_removed( $patron4->{borrowernumber} ), 0, 'Private list should not be modified (remove) by someone with the edit_public_lists sub-permission checked' );
530
    is( $private_shelf->can_biblios_be_removed( $patron5->{borrowernumber} ), 1, 'Private list should be modified (remove) by someone with the edit_public_list_contents sub-permission checked' );
408
531
409
    $private_shelf->allow_change_from_owner(1);
532
    $private_shelf->allow_change_from_owner(1);
410
    $private_shelf->allow_change_from_others(1);
533
    $private_shelf->allow_change_from_others(1);
Lines 414-439 subtest 'Shelf permissions' => sub { Link Here
414
    is( $private_shelf->can_be_viewed( $patron2->{borrowernumber} ), 0, 'Private list should not be viewed by another staff member' );
537
    is( $private_shelf->can_be_viewed( $patron2->{borrowernumber} ), 0, 'Private list should not be viewed by another staff member' );
415
    is( $private_shelf->can_be_viewed( $patron3->{borrowernumber} ), 0, 'Private list should not be viewed by someone with no special permissions' );
538
    is( $private_shelf->can_be_viewed( $patron3->{borrowernumber} ), 0, 'Private list should not be viewed by someone with no special permissions' );
416
    is( $private_shelf->can_be_viewed( $patron4->{borrowernumber} ), 0, 'Private list should not be viewed by someone with the edit_public_lists sub-permission checked' );
539
    is( $private_shelf->can_be_viewed( $patron4->{borrowernumber} ), 0, 'Private list should not be viewed by someone with the edit_public_lists sub-permission checked' );
540
    is( $private_shelf->can_be_viewed( $patron5->{borrowernumber} ), 0, 'Private list should not be viewed by someome with the edit_public_list_contents sub-permission checked' );
417
541
418
    is( $private_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' );
542
    is( $private_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' );
419
    is( $private_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Private list should not be deleted by another staff member' );
543
    is( $private_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Private list should not be deleted by another staff member' );
420
    is( $private_shelf->can_be_deleted( $patron3->{borrowernumber} ), 0, 'Private list should not be deleted by someone with no special permissions' );
544
    is( $private_shelf->can_be_deleted( $patron3->{borrowernumber} ), 0, 'Private list should not be deleted by someone with no special permissions' );
421
    is( $private_shelf->can_be_deleted( $patron4->{borrowernumber} ), 0, 'Private list should not be deleted by someone with the edit_public_lists sub-permission checked' );
545
    is( $private_shelf->can_be_deleted( $patron4->{borrowernumber} ), 0, 'Private list should not be deleted by someone with the edit_public_lists sub-permission checked' );
546
    is( $private_shelf->can_be_deleted( $patron5->{borrowernumber} ), 0, 'Private list should not be deleted by someone with the edit_public_list_contents sub-permission checked' );
422
547
423
    is( $private_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage their list' );
548
    is( $private_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage their list' );
424
    is( $private_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Private list should not be managed by another staff member' );
549
    is( $private_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Private list should not be managed by another staff member' );
425
    is( $private_shelf->can_be_managed( $patron3->{borrowernumber} ), 0, 'Private list should not be managed by someone with no special permissions' );
550
    is( $private_shelf->can_be_managed( $patron3->{borrowernumber} ), 0, 'Private list should not be managed by someone with no special permissions' );
426
    is( $private_shelf->can_be_managed( $patron4->{borrowernumber} ), 0, 'Private list should not be managed by someone with the edit_public_lists sub-permission checked' );
551
    is( $private_shelf->can_be_managed( $patron4->{borrowernumber} ), 0, 'Private list should not be managed by someone with the edit_public_lists sub-permission checked' );
552
    is( $private_shelf->can_be_managed( $patron5->{borrowernumber} ), 0, 'Private list should not be managed by someone with the edit_public_list_contents sub-permission checked' );
427
553
428
    is( $private_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 1, 'The owner should be able to add biblios to their list' );
554
    is( $private_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 1, 'The owner should be able to add biblios to their list' );
429
    is( $private_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 1, 'Private list could be modified (add) by another staff member # individual check done later' );
555
    is( $private_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 1, 'Private list could be modified (add) by another staff member # individual check done later' );
430
    is( $private_shelf->can_biblios_be_added( $patron3->{borrowernumber} ), 1, 'Private list could be modified (add) by someone with no special permissions' );
556
    is( $private_shelf->can_biblios_be_added( $patron3->{borrowernumber} ), 1, 'Private list could be modified (add) by someone with no special permissions' );
431
    is( $private_shelf->can_biblios_be_added( $patron4->{borrowernumber} ), 1, 'Private list could be modified (add) by someone with the edit_public_lists sub-permission checked' );
557
    is( $private_shelf->can_biblios_be_added( $patron4->{borrowernumber} ), 1, 'Private list could be modified (add) by someone with the edit_public_lists sub-permission checked' );
558
    is( $private_shelf->can_biblios_be_added( $patron5->{borrowernumber} ), 1, 'Private list could be modified (add) by someone with the edit_public_list_contents sub-permission checked' );
432
559
433
    is( $private_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 1, 'The owner should be able to remove biblios to their list' );
560
    is( $private_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 1, 'The owner should be able to remove biblios to their list' );
434
    is( $private_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 1, 'Private list could be modified (remove) by another staff member # individual check done later' );
561
    is( $private_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 1, 'Private list could be modified (remove) by another staff member # individual check done later' );
435
    is( $private_shelf->can_biblios_be_removed( $patron3->{borrowernumber} ), 1, 'Private list could be modified (remove) by someone with no special permissions' );
562
    is( $private_shelf->can_biblios_be_removed( $patron3->{borrowernumber} ), 1, 'Private list could be modified (remove) by someone with no special permissions' );
436
    is( $private_shelf->can_biblios_be_removed( $patron4->{borrowernumber} ), 1, 'Private list could be modified (remove) by someone with the edit_public_lists sub-permission checked' );
563
    is( $private_shelf->can_biblios_be_removed( $patron4->{borrowernumber} ), 1, 'Private list could be modified (remove) by someone with the edit_public_lists sub-permission checked' );
564
    is( $private_shelf->can_biblios_be_removed( $patron5->{borrowernumber} ), 1, 'Private list could be modified (remove) by someone with the edit_public_list_contents sub-permission checked' );
437
565
438
    teardown();
566
    teardown();
439
};
567
};
440
- 

Return to bug 30418