mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 17:45:18 -05:00
Deleting an account removed only the users document and its board, card and list memberships; 40 collections the personal-data inventory marks for deletion or anonymisation kept the person - workload, time entries, sign-in addresses, sessions, jobs, credentials, notifications, reactions, event-log tallies. models/lib/userErasure.js holds a rule per collection and runs on deletion (Users.after.remove) and anonymisation (anonymizeUser); an invoiced time entry is kept without the person, and an anonymised account keeps its references. Integrity-checked delivery records are reduced to ids by their compaction, which the inventory now names. Anonymisation replaces services whole and clears sign-in addresses, passkeys, SQRL, push and ntfy, e-mail to card and the e-mail buffer. The inventory's gap list is empty (docs/Compliance/README.md WP-4). Thanks to xet7 !
17 lines
866 B
JavaScript
17 lines
866 B
JavaScript
// Runs the erasure rules of models/lib/userErasure.js against the database:
|
|
// on account deletion (models/users.js, Users.after.remove) and on
|
|
// anonymisation (server/models/users.js, anonymizeUser). The rules name
|
|
// collections, some of them server-only modules, so they are reached through
|
|
// the driver by name rather than by importing every model here.
|
|
import { MongoInternals } from 'meteor/mongo';
|
|
|
|
const { buildUserErasure, applyUserErasure } = require('/models/lib/userErasure');
|
|
|
|
export async function runUserErasure(user, mode) {
|
|
const rules = buildUserErasure(user, mode);
|
|
if (!rules) return {};
|
|
const db = MongoInternals.defaultRemoteCollectionDriver().mongo.db;
|
|
return applyUserErasure(rules, name => db.collection(name), (collection, error) =>
|
|
console.error(`[userErasure] ${mode} of ${user._id}: ${collection} not erased:`, error));
|
|
}
|