Skip to content

Commit

Permalink
Merge pull request #17765 from mvdbeek/fix_anon_no_history_users_current
Browse files Browse the repository at this point in the history
[24.0] Don't require history to calculate anon disk usage
  • Loading branch information
martenson authored Mar 17, 2024
2 parents e2e6ba4 + 4b1b600 commit 7b88bcd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions lib/galaxy/webapps/galaxy/services/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,9 @@ def get_user(self, trans: ProvidesUserContext, user_id):
def _anon_user_api_value(self, trans: ProvidesHistoryContext):
"""Return data for an anonymous user, truncated to only usage and quota_percent"""
if not trans.user and not trans.history:
# Can't return info about this user, may not have a history yet.
# return {}
raise glx_exceptions.MessageException(err_msg="The user has no history, which should always be the case.")
usage = self.quota_agent.get_usage(trans, history=trans.history)
usage = None
else:
usage = self.quota_agent.get_usage(trans, history=trans.history)
percent = self.quota_agent.get_percent(trans=trans, usage=usage)
usage = usage or 0
return {
Expand Down
3 changes: 2 additions & 1 deletion test/integration/oidc/test_auth_oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ def test_oidc_logout(self):
response = session.get(response.json()["redirect_uri"], verify=False)
# make sure we can no longer request the user
response = session.get(self._api_url("users/current"))
self._assert_status_code_is(response, 400)
self._assert_status_code_is(response, 200)
assert "email" not in response.json()

def test_auth_by_access_token_logged_in_once(self):
# login at least once
Expand Down

0 comments on commit 7b88bcd

Please sign in to comment.