Bugzilla – Attachment 159235 Details for
Bug 34999
REST API: Public routes should respect OPACMaintenance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34999: Throw exception for public routes if OPACMaintenance is enabled
Bug-34999-Throw-exception-for-public-routes-if-OPA.patch (text/plain), 1.64 KB, created by
Marcel de Rooy
on 2023-11-24 10:59:47 UTC
(
hide
)
Description:
Bug 34999: Throw exception for public routes if OPACMaintenance is enabled
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2023-11-24 10:59:47 UTC
Size:
1.64 KB
patch
obsolete
>From d2477da52668144ec97ef26ec0898c73334c5329 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 24 Nov 2023 10:50:54 +0000 >Subject: [PATCH] Bug 34999: Throw exception for public routes if > OPACMaintenance is enabled >Content-Type: text/plain; charset=utf-8 > >Test plan: >[1] Try public endpoint like /api/v1/public/biblios/X/items. > * Replace X by an existing biblionumber. > You should receive a 200. >[2] Enable OPACMaintenance. Set to Show. >[3] Try same endpoint. You should get a 503 with a json error. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/REST/V1/Auth.pm | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > >diff --git a/Koha/REST/V1/Auth.pm b/Koha/REST/V1/Auth.pm >index b04fcaeb62..c1e077074c 100644 >--- a/Koha/REST/V1/Auth.pm >+++ b/Koha/REST/V1/Auth.pm >@@ -74,11 +74,12 @@ sub under { > $is_plugin = 1; > } > >- if ( $is_public >- and !C4::Context->preference('RESTPublicAPI') ) >- { >+ if ( $is_public ) { >+ Koha::Exceptions::UnderMaintenance->throw('Under maintenance') >+ if C4::Context->preference('OPACMaintenance'); > Koha::Exceptions::Authorization->throw( >- "Configuration prevents the usage of this endpoint by unprivileged users"); >+ "Configuration prevents the usage of this endpoint by unprivileged users") >+ if !C4::Context->preference('RESTPublicAPI'); > } > > if ( $c->req->url->to_abs->path =~ m#^/api/v1/oauth/# || $c->req->url->to_abs->path =~ m#^/api/v1/public/oauth/#) { >-- >2.30.2
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 34999
:
159234
|
159235
|
160828
|
160829
|
160840
|
160841
|
160973
|
160974