Files
wekan/client/components/settings/adminAuditLog.js
T
Lauri Ojansivu 1319f01e17 Data access in the Audit log, and AUDIT_LOG_STDOUT=json for a SIEM.
docs/Compliance/README.md WP-11 (rows 4.2 and 4.3 b):

- Admin Panel / People / Audit log has a Data access tab: who downloaded
  what - a board as JSON, CSV, Excel, PDF or ZIP, a chart, a card, every
  board, a person's data, an Admin Panel list - one row per person, day,
  kind and target with a count, the first and last time and the last
  address, never a row per download. A raw middleware in front of every
  route (server/lib/dataAccessLog.js) counts each export that answers 200,
  and a test fails when an export route is not in its list. Kept as the
  audit log (ADMIN_AUDIT_RETENTION_DAYS); erasing an account removes its
  username and address from it. Export CSV on the tab.
- AUDIT_LOG_STDOUT=json writes every audit row, security problem and data
  access also to stdout as one JSON line ({"wekan":"audit"|"security"|
  "data-access", ...}), with only the fields the Admin Panel shows - the
  arguments as stored, already redacted (models/lib/auditStdout.js). On
  every platform's settings, the snap and the Helm chart.
- The admin CSV exports obey Admin Panel's switch that turns all export
  off.

Five new strings, translated in every language. Low confidence: ace, ak,
ay, bi, bm, bo, bua, chr, csb, cv, dz, ee, ff, fj, gn, gv, haw, fur, co, ba,
bho, as, br, an, ast-ES, ha, ht, fo, iu, kl, ks, kw, nah, lld, rup, qu, sah,
se, szl, nap, scn, sc, rm, pap, lg, rn, nd, ss, nso, st, sn, ny, om, mai,
kok, la, sm, mi, tig, ve-PP, vo, wal, tlh, zgh, uz-AR, to, tpi, ts, ve, wa,
wa-RR, wo, yo, yi.

Thanks to xet7 !
2026-11-24 04:17:13 +02:00

63 lines
2.6 KiB
JavaScript

import { ReactiveVar } from 'meteor/reactive-var';
import { Template } from 'meteor/templating';
import { adminCsvLinks } from '/client/lib/adminCsvLinks';
// Admin Panel / People / Audit log: pages of server/adminAudit.js's trail.
Template.adminAuditLog.onCreated(function () {
this.tab = new ReactiveVar('audit');
this.page = new ReactiveVar(1);
this.search = new ReactiveVar('');
this.result = new ReactiveVar({ rows: [], total: 0, page: 1, perPage: 50 });
this.loading = new ReactiveVar(true);
this.autorun(() => {
const options = { page: this.page.get(), search: this.search.get() };
const method = this.tab.get() === 'access' ? 'adminDataAccessPage' : 'adminAuditLogPage';
this.loading.set(true);
Meteor.call(method, options, (error, result) => {
this.loading.set(false);
if (!error && result) this.result.set(result);
});
});
});
Template.adminAuditLog.helpers({
// WP-10: the whole log as CSV (server/routes/adminCsvExport.js); on the
// Data access tab (WP-11), the data-access log.
csvLinks() {
const name = Template.instance().tab.get() === 'access' ? 'data-access' : 'audit';
return adminCsvLinks([{ name, labelKey: 'export-csv' }]);
},
isTab(id) { return Template.instance().tab.get() === id; },
loading() { return Template.instance().loading.get(); },
rows() { return Template.instance().result.get().rows; },
total() { return Template.instance().result.get().total; },
page() { return Template.instance().page.get(); },
search() { return Template.instance().search.get(); },
pages() {
const { total, perPage } = Template.instance().result.get();
return Math.max(1, Math.ceil(total / perPage));
},
noPrev() { return Template.instance().page.get() <= 1; },
noNext() {
const { total, perPage } = Template.instance().result.get();
return Template.instance().page.get() >= Math.ceil(total / perPage);
},
when(at) { return at ? new Date(at).toLocaleString() : ''; },
});
let searchTimer = null;
Template.adminAuditLog.events({
'input .js-admin-audit-search'(event, tpl) {
const value = event.currentTarget.value;
clearTimeout(searchTimer);
searchTimer = setTimeout(() => { tpl.page.set(1); tpl.search.set(value); }, 300);
},
'click .js-admin-audit-tab'(event, tpl) {
tpl.result.set({ rows: [], total: 0, page: 1, perPage: 50 });
tpl.page.set(1);
tpl.tab.set(event.currentTarget.dataset.tab === 'access' ? 'access' : 'audit');
},
'click .js-admin-audit-prev'(event, tpl) { tpl.page.set(Math.max(1, tpl.page.get() - 1)); },
'click .js-admin-audit-next'(event, tpl) { tpl.page.set(tpl.page.get() + 1); },
});