Skip to content

Commit

Permalink
Added respective responses discerning between unauthorized (not logge…
Browse files Browse the repository at this point in the history
…d-in) andforbidden responses.
  • Loading branch information
Spaarsh committed Jan 14, 2025
1 parent 46c9ec6 commit 09669a4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion openlibrary/plugins/upstream/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()):
Expand Down

0 comments on commit 09669a4

Please sign in to comment.