From 09669a4b9065c6ccb005119f76636db4f3c9cafd Mon Sep 17 00:00:00 2001 From: Spaarsh-root Date: Tue, 14 Jan 2025 20:41:24 +0530 Subject: [PATCH] Added respective responses discerning between unauthorized (not logged-in) andforbidden responses. --- openlibrary/plugins/upstream/code.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openlibrary/plugins/upstream/code.py b/openlibrary/plugins/upstream/code.py index 34895d88ea7..709f562faff 100644 --- a/openlibrary/plugins/upstream/code.py +++ b/openlibrary/plugins/upstream/code.py @@ -139,11 +139,14 @@ class merge_work(delegate.page): def GET(self): i = web.input(records='', mrid=None, primary=None) user = web.ctx.site.get_user() + + if user is None: + raise web.unauthorized() has_access = user and ( (user.is_admin() or user.is_librarian()) or user.is_super_librarian() ) if not has_access: - raise web.HTTPError('403 Forbidden') + raise web.forbidden() optional_kwargs = {} if not (user.is_admin() or user.is_super_librarian()):