Skip to content

Commit

Permalink
Merge pull request #45 from dbmi-pitt/maxsibilla/get_user_token-fix
Browse files Browse the repository at this point in the history
Adding additional check for if auth_helper_instance.has_data_admin_pr…
  • Loading branch information
maxsibilla authored Sep 27, 2023
2 parents dd582ab + 87a2cca commit beaa2de
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,12 @@ def get_user_token(self, request_headers, admin_access_required=False):
# But we also need to ensure the user belongs to Data Admin group
# in order to execute the live reindex-all
# Return a 403 response if the user doesn't belong to Data Admin group
if not self.auth_helper_instance.has_data_admin_privs(user_token):
has_data_admin_privs = self.auth_helper_instance.has_data_admin_privs(user_token)
# The user_token is flask.Response on error
if isinstance(has_data_admin_privs, Response):
# The Response.data returns binary string, need to decode
unauthorized_error(has_data_admin_privs.data.decode())
if not has_data_admin_privs:
forbidden_error("Access not granted")
return user_token

Expand Down

0 comments on commit beaa2de

Please sign in to comment.