From 47d67f9125be64678fb9bcffbd15a34c680b0e05 Mon Sep 17 00:00:00 2001 From: Saksham Date: Tue, 25 Feb 2025 16:50:25 +0100 Subject: [PATCH] templates: record: detail: Basic audit logs --- .../invenio_app_rdm/records/detail.html | 24 +++++++++++++++++++ invenio_app_rdm/records_ui/views/records.py | 2 ++ 2 files changed, 26 insertions(+) diff --git a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/detail.html b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/detail.html index 3c7695aca..a65b6c61d 100644 --- a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/detail.html +++ b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/detail.html @@ -397,6 +397,30 @@

{{ _("Request access") }}

+
+
+

Activity Log

+
+ {% for event in logs %} +
+
+ +
+
+
+ User {{ event["_source"]["user"]["id"] }} {{ event["_source"]["message"] }} +
{{ event["_source"]["@timestamp"] }}
+
+
+
+ {% endfor %} +
+
+
+
diff --git a/invenio_app_rdm/records_ui/views/records.py b/invenio_app_rdm/records_ui/views/records.py index 428755fd4..e91476c37 100644 --- a/invenio_app_rdm/records_ui/views/records.py +++ b/invenio_app_rdm/records_ui/views/records.py @@ -227,6 +227,7 @@ def record_detail( else None ) theme = resolved_community.get("theme", {}) if resolved_community else None + logs = current_app.datastream_logger.search("audit", record.id) return render_community_theme_template( current_app.config.get("APP_RDM_RECORD_LANDING_PAGE_TEMPLATE"), @@ -258,6 +259,7 @@ def record_detail( record_owner_id=( record_owner.get("id") ), # record created with system_identity have not owners e.g demo + logs=logs, )