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 => 13; |
25 |
plan tests => 14; |
26 |
my $patron = $builder->build({ |
26 |
my $patron = $builder->build({ |
27 |
source => 'Borrower', |
27 |
source => 'Borrower', |
28 |
}); |
28 |
}); |
Lines 44-49
subtest 'CRUD' => sub {
Link Here
|
44 |
is( $number_of_shelves, 1, '1 shelf should have been inserted' ); |
44 |
is( $number_of_shelves, 1, '1 shelf should have been inserted' ); |
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( t::lib::Dates::compare( $shelf->created_on, dt_from_string), 0, 'The creation time should have been set to today' ); |
48 |
is( t::lib::Dates::compare( $shelf->created_on, dt_from_string), 0, 'The creation time should have been set to today' ); |
48 |
|
49 |
|
49 |
# Test if creation date will not be overwritten by store |
50 |
# Test if creation date will not be overwritten by store |
Lines 171-179
subtest 'Sharing' => sub {
Link Here
|
171 |
|
172 |
|
172 |
subtest 'Shelf content' => sub { |
173 |
subtest 'Shelf content' => sub { |
173 |
|
174 |
|
174 |
plan tests => 18; |
175 |
plan tests => 21; |
175 |
my $patron1 = $builder->build( { source => 'Borrower', } ); |
176 |
my $patron1 = $builder->build( { source => 'Borrower', } ); |
176 |
my $patron2 = $builder->build( { source => 'Borrower', } ); |
177 |
my $patron2 = $builder->build( { source => 'Borrower', } ); |
|
|
178 |
my $patron3 = $builder->build( { source => 'Borrower', value => {flags => 1} }); |
177 |
my $biblio1 = $builder->build_sample_biblio; |
179 |
my $biblio1 = $builder->build_sample_biblio; |
178 |
my $biblio2 = $builder->build_sample_biblio; |
180 |
my $biblio2 = $builder->build_sample_biblio; |
179 |
my $biblio3 = $builder->build_sample_biblio; |
181 |
my $biblio3 = $builder->build_sample_biblio; |
Lines 247-264
subtest 'Shelf content' => sub {
Link Here
|
247 |
$number_of_contents = Koha::Virtualshelfcontents->search->count; |
249 |
$number_of_contents = Koha::Virtualshelfcontents->search->count; |
248 |
is( $number_of_contents, 3, 'Back to three entries' ); |
250 |
is( $number_of_contents, 3, 'Back to three entries' ); |
249 |
|
251 |
|
|
|
252 |
# allow_change_from_staff == 1 and allow_change_from_others == 0 |
253 |
$shelf->allow_change_from_staff( 1 ); |
254 |
$shelf->allow_change_from_others( 0 ); |
255 |
$content4 = $shelf->add_biblio( $biblio3->biblionumber, $patron3->{borrowernumber} ); |
256 |
$number_of_contents = Koha::Virtualshelfcontents->search->count; |
257 |
is( $number_of_contents, 4, 'The biblio should have been added to the shelf by patron 2'); |
258 |
$number_of_deleted_biblios = $shelf->remove_biblios( { biblionumbers => [ $biblio3->biblionumber ], borrowernumber => $patron3->{borrowernumber} } ); |
259 |
is( $number_of_deleted_biblios, 1, 'Biblio 3 deleted by patron 2' ); |
260 |
$number_of_contents = Koha::Virtualshelfcontents->search->count; |
261 |
is( $number_of_contents, 3, 'Back to three entries' ); |
262 |
|
250 |
teardown(); |
263 |
teardown(); |
251 |
}; |
264 |
}; |
252 |
|
265 |
|
253 |
subtest 'Shelf permissions' => sub { |
266 |
subtest 'Shelf permissions' => sub { |
254 |
|
267 |
|
255 |
plan tests => 40; |
268 |
plan tests => 100; |
256 |
my $patron1 = $builder->build( { source => 'Borrower', value => { flags => '2096766' } } ); # 2096766 is everything checked but not superlibrarian |
269 |
my $patron1 = $builder->build( { source => 'Borrower', value => { flags => '2096766' } } ); # 2096766 is everything checked but not superlibrarian |
257 |
my $patron2 = $builder->build( { source => 'Borrower', value => { flags => '1048190' } } ); # 1048190 is everything checked but not superlibrarian and delete_public_lists |
270 |
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 |
272 |
my $patron4 = $builder->build( { source => 'Borrower', value => { flags => '0' } } ); |
273 |
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 |
275 |
|
258 |
my $biblio1 = $builder->build_sample_biblio; |
276 |
my $biblio1 = $builder->build_sample_biblio; |
259 |
my $biblio2 = $builder->build_sample_biblio; |
277 |
my $biblio2 = $builder->build_sample_biblio; |
260 |
my $biblio3 = $builder->build_sample_biblio; |
278 |
my $biblio3 = $builder->build_sample_biblio; |
261 |
my $biblio4 = $builder->build_sample_biblio; |
279 |
my $biblio4 = $builder->build_sample_biblio; |
|
|
280 |
my $biblio5 = $builder->build_sample_biblio; |
262 |
|
281 |
|
263 |
my $public_shelf = Koha::Virtualshelf->new( |
282 |
my $public_shelf = Koha::Virtualshelf->new( |
264 |
{ shelfname => "my first shelf", |
283 |
{ shelfname => "my first shelf", |
Lines 266-308
subtest 'Shelf permissions' => sub {
Link Here
|
266 |
public => 1, |
285 |
public => 1, |
267 |
allow_change_from_owner => 0, |
286 |
allow_change_from_owner => 0, |
268 |
allow_change_from_others => 0, |
287 |
allow_change_from_others => 0, |
|
|
288 |
allow_change_from_staff => 0, |
269 |
} |
289 |
} |
270 |
)->store; |
290 |
)->store; |
271 |
|
291 |
|
272 |
is( $public_shelf->can_be_viewed( $patron1->{borrowernumber} ), 1, 'The owner should be able to view his public list' ); |
292 |
is( $public_shelf->can_be_viewed( $patron1->{borrowernumber} ), 1, 'The owner should be able to view their public list' ); |
273 |
is( $public_shelf->can_be_viewed( $patron2->{borrowernumber} ), 1, 'Public list should be viewed by someone else' ); |
293 |
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' ); |
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' ); |
274 |
|
296 |
|
275 |
is( $public_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete his list' ); |
297 |
is( $public_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' ); |
276 |
is( $public_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Public list should not be deleted by someone else' ); |
298 |
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' ); |
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' ); |
277 |
|
301 |
|
278 |
is( $public_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage his list' ); |
302 |
is( $public_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage their list' ); |
279 |
is( $public_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Public list should not be managed by someone else' ); |
303 |
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' ); |
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' ); |
280 |
|
306 |
|
281 |
is( $public_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 0, 'The owner should not be able to add biblios to their list' ); |
307 |
is( $public_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 0, 'The owner should not be able to add biblios to their list' ); |
282 |
is( $public_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone else' ); |
308 |
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' ); |
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' ); |
283 |
|
311 |
|
284 |
is( $public_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 0, 'The owner should not be able to remove biblios to their list' ); |
312 |
is( $public_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 0, 'The owner should not be able to remove biblios to their list' ); |
285 |
is( $public_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 0, 'Public list should not be modified (remove) by someone else' ); |
313 |
is( $public_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 0, 'Public list should not be modified (remove) by another staff member' ); |
286 |
|
314 |
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' ); |
287 |
|
316 |
|
288 |
$public_shelf->allow_change_from_owner(1); |
317 |
$public_shelf->allow_change_from_owner(1); |
289 |
$public_shelf->store; |
318 |
$public_shelf->store; |
290 |
|
319 |
|
291 |
is( $public_shelf->can_be_viewed( $patron1->{borrowernumber} ), 1, 'The owner should be able to view his public list' ); |
320 |
is( $public_shelf->can_be_viewed( $patron1->{borrowernumber} ), 1, 'The owner should be able to view their public list' ); |
292 |
is( $public_shelf->can_be_viewed( $patron2->{borrowernumber} ), 1, 'Public list should be viewed by someone else' ); |
321 |
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' ); |
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' ); |
293 |
|
324 |
|
294 |
is( $public_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete his list' ); |
325 |
is( $public_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' ); |
295 |
is( $public_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Public list should not be deleted by someone else' ); |
326 |
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' ); |
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' ); |
296 |
|
329 |
|
297 |
is( $public_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage his list' ); |
330 |
is( $public_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage thier list' ); |
298 |
is( $public_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Public list should not be managed by someone else' ); |
331 |
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' ); |
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' ); |
299 |
|
334 |
|
300 |
is( $public_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 1, 'The owner should be able to add biblios to his list' ); |
335 |
is( $public_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 1, 'The owner should be able to add biblios to their list' ); |
301 |
is( $public_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone else' ); |
336 |
is( $public_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 0, 'Public list should not be modified (add) by another staff member' ); |
302 |
|
337 |
is( $public_shelf->can_biblios_be_added( $patron3->{borrowernumber} ), 0, 'Public list should not be modified (add) by someone with no special permissions' ); |
303 |
is( $public_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 1, 'The owner should be able to remove biblios to his list' ); |
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' ); |
304 |
is( $public_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 0, 'Public list should not be modified (remove) by someone else' ); |
|
|
305 |
|
339 |
|
|
|
340 |
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' ); |
342 |
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' ); |
306 |
|
344 |
|
307 |
my $private_shelf = Koha::Virtualshelf->new( |
345 |
my $private_shelf = Koha::Virtualshelf->new( |
308 |
{ shelfname => "my first shelf", |
346 |
{ shelfname => "my first shelf", |
Lines 310-352
subtest 'Shelf permissions' => sub {
Link Here
|
310 |
public => 0, |
348 |
public => 0, |
311 |
allow_change_from_owner => 0, |
349 |
allow_change_from_owner => 0, |
312 |
allow_change_from_others => 0, |
350 |
allow_change_from_others => 0, |
|
|
351 |
allow_change_from_staff => 0, |
313 |
} |
352 |
} |
314 |
)->store; |
353 |
)->store; |
315 |
|
354 |
|
316 |
is( $private_shelf->can_be_viewed( $patron1->{borrowernumber} ), 1, 'The owner should be able to view his list' ); |
355 |
is( $private_shelf->can_be_viewed( $patron1->{borrowernumber} ), 1, 'The owner should be able to view their list' ); |
317 |
is( $private_shelf->can_be_viewed( $patron2->{borrowernumber} ), 0, 'Private list should not be viewed by someone else' ); |
356 |
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' ); |
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' ); |
318 |
|
359 |
|
319 |
is( $private_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete his list' ); |
360 |
is( $private_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' ); |
320 |
is( $private_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Private list should not be deleted by someone else' ); |
361 |
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' ); |
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' ); |
321 |
|
364 |
|
322 |
is( $private_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage his list' ); |
365 |
is( $private_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage their list' ); |
323 |
is( $private_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Private list should not be managed by someone else' ); |
366 |
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' ); |
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' ); |
324 |
|
369 |
|
325 |
is( $private_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 0, 'The owner should not be able to add biblios to their list' ); |
370 |
is( $private_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 0, 'The owner should not be able to add biblios to their list' ); |
326 |
is( $private_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 0, 'Private list should not be modified (add) by someone else' ); |
371 |
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' ); |
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' ); |
327 |
|
374 |
|
328 |
is( $private_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 0, 'The owner should not be able to remove biblios to their list' ); |
375 |
is( $private_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 0, 'The owner should not be able to remove biblios to their list' ); |
329 |
is( $private_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 0, 'Private list should not be modified (remove) by someone else' ); |
376 |
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' ); |
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' ); |
330 |
|
379 |
|
|
|
380 |
$private_shelf->allow_change_from_owner(1); |
381 |
$private_shelf->allow_change_from_staff(1); |
382 |
$private_shelf->allow_change_from_others(0); |
383 |
$private_shelf->store; |
384 |
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' ); |
386 |
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' ); |
388 |
|
389 |
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' ); |
391 |
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' ); |
393 |
|
394 |
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' ); |
396 |
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' ); |
398 |
|
399 |
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' ); |
401 |
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' ); |
403 |
|
404 |
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' ); |
406 |
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' ); |
331 |
|
408 |
|
332 |
$private_shelf->allow_change_from_owner(1); |
409 |
$private_shelf->allow_change_from_owner(1); |
333 |
$private_shelf->allow_change_from_others(1); |
410 |
$private_shelf->allow_change_from_others(1); |
334 |
$private_shelf->store; |
411 |
$private_shelf->store; |
335 |
|
412 |
|
336 |
is( $private_shelf->can_be_viewed( $patron1->{borrowernumber} ), 1, 'The owner should be able to view his list' ); |
413 |
is( $private_shelf->can_be_viewed( $patron1->{borrowernumber} ), 1, 'The owner should be able to view their list' ); |
337 |
is( $private_shelf->can_be_viewed( $patron2->{borrowernumber} ), 0, 'Private list should not be viewed by someone else' ); |
414 |
is( $private_shelf->can_be_viewed( $patron2->{borrowernumber} ), 0, 'Private list should not be viewed by another staff member' ); |
338 |
|
415 |
is( $private_shelf->can_be_viewed( $patron3->{borrowernumber} ), 0, 'Private list should not be viewed by someone with no special permissions' ); |
339 |
is( $private_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete his list' ); |
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' ); |
340 |
is( $private_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Private list should not be deleted by someone else' ); |
417 |
|
341 |
|
418 |
is( $private_shelf->can_be_deleted( $patron1->{borrowernumber} ), 1, 'The owner should be able to delete their list' ); |
342 |
is( $private_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage his list' ); |
419 |
is( $private_shelf->can_be_deleted( $patron2->{borrowernumber} ), 0, 'Private list should not be deleted by another staff member' ); |
343 |
is( $private_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Private list should not be managed by someone else' ); |
420 |
is( $private_shelf->can_be_deleted( $patron3->{borrowernumber} ), 0, 'Private list should not be deleted by someone with no special permissions' ); |
344 |
|
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' ); |
345 |
is( $private_shelf->can_biblios_be_added( $patron1->{borrowernumber} ), 1, 'The owner should be able to add biblios to his list' ); |
422 |
|
346 |
is( $private_shelf->can_biblios_be_added( $patron2->{borrowernumber} ), 1, 'Private list could be modified (add) by someone else # individual check done later' ); |
423 |
is( $private_shelf->can_be_managed( $patron1->{borrowernumber} ), 1, 'The owner should be able to manage their list' ); |
347 |
|
424 |
is( $private_shelf->can_be_managed( $patron2->{borrowernumber} ), 0, 'Private list should not be managed by another staff member' ); |
348 |
is( $private_shelf->can_biblios_be_removed( $patron1->{borrowernumber} ), 1, 'The owner should be able to remove biblios to his list' ); |
425 |
is( $private_shelf->can_be_managed( $patron3->{borrowernumber} ), 0, 'Private list should not be managed by someone with no special permissions' ); |
349 |
is( $private_shelf->can_biblios_be_removed( $patron2->{borrowernumber} ), 1, 'Private list could be modified (remove) by someone else # individual check done later' ); |
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' ); |
|
|
427 |
|
428 |
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' ); |
430 |
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' ); |
432 |
|
433 |
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' ); |
435 |
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' ); |
350 |
|
437 |
|
351 |
teardown(); |
438 |
teardown(); |
352 |
}; |
439 |
}; |