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

(-)a/api/v1/swagger/paths/biblios.yaml (-1 / +2 lines)
Lines 403-409 Link Here
403
          $ref: "../swagger.yaml#/definitions/error"
403
          $ref: "../swagger.yaml#/definitions/error"
404
    x-koha-authorization:
404
    x-koha-authorization:
405
      permissions:
405
      permissions:
406
        circulate: circulate_remaining_permissions
406
        - circulate: circulate_remaining_permissions
407
        - circulate: manage_bookings
407
"/biblios/{biblio_id}/items":
408
"/biblios/{biblio_id}/items":
408
  get:
409
  get:
409
    x-mojo-to: Biblios#get_items
410
    x-mojo-to: Biblios#get_items
(-)a/t/db_dependent/api/v1/biblios.t (-6 / +37 lines)
Lines 726-732 subtest 'get_bookings() tests' => sub { Link Here
726
726
727
subtest 'get_checkouts() tests' => sub {
727
subtest 'get_checkouts() tests' => sub {
728
728
729
    plan tests => 14;
729
    plan tests => 17;
730
730
731
    $schema->storage->txn_begin;
731
    $schema->storage->txn_begin;
732
732
Lines 745-755 subtest 'get_checkouts() tests' => sub { Link Here
745
    $t->get_ok("//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/checkouts")
745
    $t->get_ok("//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/checkouts")
746
      ->status_is(403);
746
      ->status_is(403);
747
747
748
    $patron->flags(1)->store; # circulate permissions
748
    $builder->build(
749
        {
750
            source => 'UserPermission',
751
            value  => {
752
                borrowernumber => $patron->borrowernumber,
753
                module_bit     => 1,
754
                code           => 'circulate_remaining_permissions',
755
            },
756
        }
757
    );
758
759
    $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/checkouts" )
760
        ->status_is( 200, 'circulate_remaining_permissions allows checkouts access' )
761
        ->json_is( '' => [], 'No checkouts on the biblio' );
749
762
750
    $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/checkouts")
763
    my $bookings_librarian = $builder->build_object(
751
      ->status_is(200)
764
        {
752
      ->json_is( '' => [], 'No checkouts on the biblio' );
765
            class => 'Koha::Patrons',
766
            value => { flags => 0 }     # no additional permissions
767
        }
768
    );
769
    $builder->build(
770
        {
771
            source => 'UserPermission',
772
            value  => {
773
                borrowernumber => $bookings_librarian->borrowernumber,
774
                module_bit     => 1,
775
                code           => 'manage_bookings',
776
            },
777
        }
778
    );
779
    $bookings_librarian->set_password( { password => $password, skip_validation => 1 } );
780
    my $bookings_userid = $bookings_librarian->userid;
781
782
    $t->get_ok( "//$bookings_userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/checkouts" )
783
        ->status_is( 200, 'manage_bookings allows checkouts access' )
784
        ->json_is( '' => [], 'No checkouts on the biblio' );
753
785
754
    my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber });
786
    my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber });
755
    my $item_2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber });
787
    my $item_2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber });
756
- 

Return to bug 35469