mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
Nothing recorded who set somebody's password, made somebody an admin, changed a login setting or restored a backup. Every call of those administrative methods by a site administrator is now kept, one document each, for a year: when, who, which action, the outcome - a refused call too - its arguments and the address. A password or a secret never reaches the trail: values under a credential-named key, the arguments that are a password by position, and a password inside a URL are replaced by [redacted]. An administrator editing cards is not in it, the trail is shown to site administrators only, and a trail that cannot be written never changes what the method did. It and the REQUIRE_2FA wrapper keep each other's marks, so neither wraps the other twice. The new interface strings are pending translation. Thanks to xet7 !
48 lines
1.9 KiB
JavaScript
48 lines
1.9 KiB
JavaScript
import { ReactiveVar } from 'meteor/reactive-var';
|
|
import { Template } from 'meteor/templating';
|
|
|
|
// Admin Panel / People / Audit log: pages of server/adminAudit.js's trail.
|
|
Template.adminAuditLog.onCreated(function () {
|
|
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() };
|
|
this.loading.set(true);
|
|
Meteor.call('adminAuditLogPage', options, (error, result) => {
|
|
this.loading.set(false);
|
|
if (!error && result) this.result.set(result);
|
|
});
|
|
});
|
|
});
|
|
|
|
Template.adminAuditLog.helpers({
|
|
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-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); },
|
|
});
|