Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[24.0] Don't require history to calculate anon disk usage #17765

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading