From af923d6b8f2db445cf431382144d428de8081534 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Mon, 10 Jun 2024 12:29:46 +0200 Subject: [PATCH] Fix anonymous user job retrieval logic For anonymous users, if a history_id is provided, do not override with the current session history and instead rely on the history accessibility --- lib/galaxy/managers/jobs.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/galaxy/managers/jobs.py b/lib/galaxy/managers/jobs.py index 2b7b3d7a94e..cb6e88eadd7 100644 --- a/lib/galaxy/managers/jobs.py +++ b/lib/galaxy/managers/jobs.py @@ -127,12 +127,15 @@ class JobManager: search = payload.search order_by = payload.order_by - if trans.user is None: - # If the user is anonymous we can only return jobs for the current session history - if trans.galaxy_session and trans.galaxy_session.current_history_id: - history_id = trans.galaxy_session.current_history_id - else: - return None + if ( + trans.user is None + and history_id is None + and trans.galaxy_session + and trans.galaxy_session.current_history_id + ): + # If the user is anonymous and no specific history_id was provided + # we can only return jobs from the history in the current session + history_id = trans.galaxy_session.current_history_id def build_and_apply_filters(stmt, objects, filter_func): if objects is not None: