Bugzilla – Attachment 115970 Details for
Bug 27330
Wrong return status when no enrollments in club holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27330: Return 403 if club has no enrollments
Bug-27330-Return-403-if-club-has-no-enrollments.patch (text/plain), 1.78 KB, created by
Martin Renvoize (ashimema)
on 2021-01-28 15:51:24 UTC
(
hide
)
Description:
Bug 27330: Return 403 if club has no enrollments
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-01-28 15:51:24 UTC
Size:
1.78 KB
patch
obsolete
>From 3e5d5cc271d493dd18a95efd4a4a22a9d51b7ef7 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 4 Jan 2021 11:24:51 -0300 >Subject: [PATCH] Bug 27330: Return 403 if club has no enrollments > >This patch makes the controller script return a 403 as it should [1] >instead of a plain 500. > >To test: >1. Apply the regressions tests patch >2. Run: > $ kshell > k$ prove t/db_dependent/api/v1/clubs_holds.t >=> FAIL: Tests fail! >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Sign off :-D > >[1] https://www.restapitutorial.com/httpstatuscodes.html > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/REST/V1/Clubs/Holds.pm | 14 ++------------ > 1 file changed, 2 insertions(+), 12 deletions(-) > >diff --git a/Koha/REST/V1/Clubs/Holds.pm b/Koha/REST/V1/Clubs/Holds.pm >index 78f741acd0..9a4aaa052a 100644 >--- a/Koha/REST/V1/Clubs/Holds.pm >+++ b/Koha/REST/V1/Clubs/Holds.pm >@@ -128,19 +128,9 @@ sub add { > } > catch { > if ( blessed $_ ) { >- if ( $_->isa('Koha::Exceptions::Object::FKConstraint') ) { >- my $broken_fk = $_->broken_fk; >- >- if ( grep { $_ eq $broken_fk } keys %{$Koha::REST::V1::Clubs::Holds::to_api_mapping} ) { >- $c->render( >- status => 404, >- openapi => $Koha::REST::V1::Clubs::Holds::to_api_mapping->{$broken_fk} . ' not found.' >- ); >- } >- } >- elsif ($_->isa('Koha::Exceptions::ClubHold')) { >+ if ($_->isa('Koha::Exceptions::ClubHold::NoPatrons')) { > return $c->render( >- status => 500, >+ status => 403, > openapi => { error => $_->description } > ); > } >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27330
:
114798
|
114799
|
114800
|
115863
|
115864
|
115865
|
115866
|
115867
|
115968
|
115969
|
115970
|
115971
|
115972
|
116109
|
116110
|
116111
|
116112
|
116113