From a9c63100c3b9a0381deaebb5703047bc1fcaa192 Mon Sep 17 00:00:00 2001 From: Mohammed Taha Khan Date: Tue, 10 Nov 2026 14:25:46 +0100 Subject: [PATCH] fix(harvester): hide system user from harvester reports --- site/cds_rdm/administration/harvester_reports.py | 14 +++++++++++--- .../administration/harvesterReports/SearchBar.js | 5 +---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/site/cds_rdm/administration/harvester_reports.py b/site/cds_rdm/administration/harvester_reports.py index 82a41ed8..4f761a42 100644 --- a/site/cds_rdm/administration/harvester_reports.py +++ b/site/cds_rdm/administration/harvester_reports.py @@ -16,12 +16,22 @@ from invenio_search_ui.searchconfig import search_app_config from cds_rdm.administration.permissions import curators_permission +from cds_rdm.generators import _harvester_user_id from cds_rdm.inspire_harvester.reports.runs.logs import ( HarvesterRunError, report_context, ) +def harvester_report_hidden_params(): + """Hidden search params for harvester reports (action + harvester user).""" + params = [["action", "record.publish"]] + harvester_user_id = _harvester_user_id() + if harvester_user_id is not None: + params.append(["user_id", harvester_user_id]) + return params + + def create_harvester_report_blueprint(app): """Create the harvester run report UI blueprint.""" blueprint = Blueprint("cds_rdm_harvester_report_page", __name__) @@ -156,7 +166,5 @@ def init_search_config(self, **kwargs): headers=self.get_search_request_headers(**kwargs), pagination_options=(20, 50), default_size=20, - hidden_params=[ - ["action", "record.publish"], - ], + hidden_params=harvester_report_hidden_params(), ) diff --git a/site/cds_rdm/assets/semantic-ui/js/cds_rdm/administration/harvesterReports/SearchBar.js b/site/cds_rdm/assets/semantic-ui/js/cds_rdm/administration/harvesterReports/SearchBar.js index 840e408b..cb2b867c 100644 --- a/site/cds_rdm/assets/semantic-ui/js/cds_rdm/administration/harvesterReports/SearchBar.js +++ b/site/cds_rdm/assets/semantic-ui/js/cds_rdm/administration/harvesterReports/SearchBar.js @@ -19,8 +19,6 @@ import { import { DownloadButton } from "./DownloadButton"; import PropTypes from "prop-types"; -const hiddenParams = [["action", "record.publish"]]; - /** * Custom SearchBar component with run selector */ @@ -52,10 +50,10 @@ const SearchBarComponent = ({ updateQueryState, currentQueryState }) => { } setInputValue(queryString); + // Do not override hiddenParams — server sets action + harvester user_id. updateQueryState({ ...currentQueryState, queryString, - hiddenParams, }); }, [currentQueryState, updateQueryState] @@ -85,7 +83,6 @@ const SearchBarComponent = ({ updateQueryState, currentQueryState }) => { updateQueryState({ ...currentQueryState, queryString: inputValue, - hiddenParams, }); const id = extractRunIdFromQuery(inputValue, runs); if (id) {