diff --git a/backend/capellacollab/sessions/routes.py b/backend/capellacollab/sessions/routes.py index 884ef9658a..b7f889dde3 100644 --- a/backend/capellacollab/sessions/routes.py +++ b/backend/capellacollab/sessions/routes.py @@ -283,7 +283,6 @@ def request_persistent_session( ), db: orm.Session = fastapi.Depends(database.get_db), operator: k8s.KubernetesOperator = fastapi.Depends(operators.get_operator), - username: str = fastapi.Depends(auth_injectables.get_username), ): log.info("Starting persistent session for user %s", user.name) @@ -294,6 +293,12 @@ def request_persistent_session( raise_if_conflicting_persistent_sessions(tool, user) + response = start_persistent_session(user, tool, version, operator, db) + + return response + + +def start_persistent_session(user, tool, version, operator, db): environment: dict[str, str] = {} volumes: list[operators_models.Volume] = [] warnings: list[core_models.Message] = [] @@ -304,7 +309,7 @@ def request_persistent_session( user=user, tool_version=version, tool=tool, - username=username, + username=user.name, operator=operator, ) environment |= hook_env diff --git a/backend/tests/sessions/test_session_hooks.py b/backend/tests/sessions/test_session_hooks.py index 36c1a73dc9..bcc644756b 100644 --- a/backend/tests/sessions/test_session_hooks.py +++ b/backend/tests/sessions/test_session_hooks.py @@ -162,7 +162,6 @@ def test_session_creation_hook_is_called( user, db, mockoperator, - "testuser", ) assert session_hook.configuration_hook_counter == 1