Skip to content

Commit

Permalink
permissions: fix error message for users
Browse files Browse the repository at this point in the history
When a user that doesn't have the patron, librarian or system librarian
role, the message "Permission required" is displayed instead of
"Internal server error".

* Closes #1508

Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
Garfield-fr committed Dec 1, 2020
1 parent f6c73a8 commit 9726ad9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rero_ils/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ def decorated_view(*args, **kwargs):
return current_app.login_manager.unauthorized()
else:
patron = Patron.get_patron_by_user(current_user)
if patron.is_librarian or patron.is_system_librarian:
return func(*args, **kwargs)
else:
if not patron or (not patron.is_librarian and
not patron.is_system_librarian):
abort(403)
return func(*args, **kwargs)
return decorated_view


Expand Down

0 comments on commit 9726ad9

Please sign in to comment.