From a20c3deb25c6c2fc70bb7f17dc5eb6915df8c484 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sat, 16 Mar 2024 17:26:29 +0100 Subject: [PATCH 1/2] Don't require history to calculate anon disk usage This is probably the simplest way to fix the anon user issue. If we don't have a history the size is 0, that's fairly simple. We might still want to do https://github.com/galaxyproject/galaxy/pull/17755 for those FastAPI endpoints that do actually require a default history. --- lib/galaxy/webapps/galaxy/services/users.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/services/users.py b/lib/galaxy/webapps/galaxy/services/users.py index 91bcf390c0a7..fa820748c11c 100644 --- a/lib/galaxy/webapps/galaxy/services/users.py +++ b/lib/galaxy/webapps/galaxy/services/users.py @@ -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 { From 4b1b600139c6f04c81d789c939ae3b21222ab47a Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Sat, 16 Mar 2024 17:46:08 -0700 Subject: [PATCH 2/2] fix oidc logout test which relied on receiving 400 --- test/integration/oidc/test_auth_oidc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/integration/oidc/test_auth_oidc.py b/test/integration/oidc/test_auth_oidc.py index 1674e9353079..29ff1c18b2b6 100644 --- a/test/integration/oidc/test_auth_oidc.py +++ b/test/integration/oidc/test_auth_oidc.py @@ -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