From 2bdf3dd193c077ea7e60f1e3c73088c9d8efffaa Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 10 Apr 2023 14:54:30 -0300 Subject: [PATCH] Bug 31795: Fix required permissions Signed-off-by: Tomas Cohen Arazi Signed-off-by: David Nind Signed-off-by: Nick Clemens --- api/v1/swagger/paths/authorities.yaml | 2 +- t/db_dependent/api/v1/authorities.t | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/api/v1/swagger/paths/authorities.yaml b/api/v1/swagger/paths/authorities.yaml index e733cf764e..45a18cc217 100644 --- a/api/v1/swagger/paths/authorities.yaml +++ b/api/v1/swagger/paths/authorities.yaml @@ -73,7 +73,7 @@ $ref: "../swagger.yaml#/definitions/error" x-koha-authorization: permissions: - editcatalogue: edit_catalogue + editauthorities: "1" "/authorities/{authority_id}": get: x-mojo-to: Authorities#get diff --git a/t/db_dependent/api/v1/authorities.t b/t/db_dependent/api/v1/authorities.t index 1ead19fc8d..3da737e9ad 100755 --- a/t/db_dependent/api/v1/authorities.t +++ b/t/db_dependent/api/v1/authorities.t @@ -189,16 +189,7 @@ subtest 'post() tests' => sub { ->status_is(403, 'Not enough permissions makes it return the right code'); # Add permissions - $builder->build( - { - source => 'UserPermission', - value => { - borrowernumber => $patron->borrowernumber, - module_bit => 9, - code => 'edit_catalogue' - } - } - ); + $patron->flags( 2 ** 14 )->store; # 14 => editauthorities userflag # x-koha-override passed to make sure it goes through $t->post_ok("//$userid:$password@/api/v1/authorities" => {'Content-Type' => 'application/marcxml+xml', 'x-authority-type' => 'CORPO_NAME', 'x-koha-override' => 'any' } => $marcxml) -- 2.30.2