@cosmicdrift/kumiko-bundled-features 0.278.0 → 0.280.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/src/auth-email-password/__tests__/invite-flow-kms.integration.test.ts +8 -2
- package/src/auth-mfa-user-data/__tests__/hooks.integration.test.ts +6 -6
- package/src/auth-mfa-user-data/hooks.ts +4 -6
- package/src/custom-fields/__tests__/user-data-rights.integration.test.ts +10 -3
- package/src/custom-fields/wire-user-data-rights.ts +40 -24
- package/src/data-retention/resolve-for-tenant.ts +18 -6
- package/src/delivery/db/queries/preferences.ts +1 -0
- package/src/files-tenant-data/hooks.ts +3 -5
- package/src/folders/__tests__/folders.integration.test.ts +4 -3
- package/src/folders-user-data/__tests__/hooks.integration.test.ts +2 -1
- package/src/folders-user-data/hooks.ts +5 -10
- package/src/form-draft-user-data/__tests__/hooks-delete-failure.integration.test.ts +7 -1
- package/src/form-draft-user-data/__tests__/hooks.integration.test.ts +16 -5
- package/src/form-draft-user-data/hooks.ts +3 -6
- package/src/notes-history-user-data/__tests__/hooks.integration.test.ts +9 -3
- package/src/notes-history-user-data/hooks.ts +3 -4
- package/src/personal-access-tokens/handlers/create.write.ts +1 -0
- package/src/template-resolver-user-data/hooks.ts +1 -2
- package/src/tenant-lifecycle/feature.ts +2 -0
- package/src/tenant-lifecycle/run-tenant-destroy.ts +9 -0
- package/src/tenant-lifecycle/stages.ts +26 -2
- package/src/user-data-rights/__tests__/cross-data-matrix.integration.test.ts +5 -14
- package/src/user-data-rights/__tests__/escape-hatch-audit.integration.test.ts +133 -0
- package/src/user-data-rights/__tests__/escape-hatch-declaration.integration.test.ts +198 -0
- package/src/user-data-rights/__tests__/forget-cleanup-hook-ordering.integration.test.ts +15 -3
- package/src/user-data-rights/__tests__/forget-cleanup-search-purge-ordering.integration.test.ts +10 -2
- package/src/user-data-rights/__tests__/mail-default-bridge.integration.test.ts +3 -1
- package/src/user-data-rights/__tests__/run-export-jobs-cron-context.integration.test.ts +8 -3
- package/src/user-data-rights/__tests__/run-forget-cleanup.integration.test.ts +8 -2
- package/src/user-data-rights/__tests__/run-user-export.integration.test.ts +8 -4
- package/src/user-data-rights/__tests__/tenant-model-erasure.integration.test.ts +15 -5
- package/src/user-data-rights/feature.ts +4 -0
- package/src/user-data-rights/run-export-jobs.ts +16 -1
- package/src/user-data-rights/run-forget-cleanup.ts +44 -2
- package/src/user-data-rights/run-user-export.ts +43 -3
- package/src/user-data-rights-defaults/__tests__/bundled-entities.userdata-hooks.integration.test.ts +7 -6
- package/src/user-data-rights-defaults/__tests__/user-data-rights-defaults.integration.test.ts +64 -18
- package/src/user-data-rights-defaults/hooks/api-token.userdata-hook.ts +2 -3
- package/src/user-data-rights-defaults/hooks/config-value.userdata-hook.ts +4 -6
- package/src/user-data-rights-defaults/hooks/delivery-attempt.userdata-hook.ts +1 -2
- package/src/user-data-rights-defaults/hooks/file-ref.userdata-hook.ts +5 -11
- package/src/user-data-rights-defaults/hooks/in-app-message.userdata-hook.ts +2 -3
- package/src/user-data-rights-defaults/hooks/job-run.userdata-hook.ts +1 -2
- package/src/user-data-rights-defaults/hooks/notification-preference.userdata-hook.ts +4 -6
- package/src/user-data-rights-defaults/hooks/tenant-invitation.userdata-hook.ts +8 -10
- package/src/user-data-rights-defaults/hooks/user-session.userdata-hook.ts +2 -3
- package/src/user-data-rights-defaults/hooks/user.userdata-hook.ts +9 -10
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createEventStoreExecutor, createTenantDb } from "@cosmicdrift/kumiko-framework/db";
|
|
1
|
+
import { createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
|
|
3
2
|
import {
|
|
4
3
|
createSystemUser,
|
|
5
4
|
type UserDataDeleteHook,
|
|
@@ -21,7 +20,7 @@ const crud = createEventStoreExecutor(configValuesTable, configValueEntity, {
|
|
|
21
20
|
|
|
22
21
|
export const configValueExportHook: UserDataExportHook = async (ctx) => {
|
|
23
22
|
if (!featureMounted(ctx, "config")) return null;
|
|
24
|
-
const rows = await selectMany<Record<string, unknown>>(
|
|
23
|
+
const rows = await ctx.db.selectMany<Record<string, unknown>>(configValuesTable, {
|
|
25
24
|
tenantId: ctx.tenantId,
|
|
26
25
|
userId: ctx.userId,
|
|
27
26
|
});
|
|
@@ -39,14 +38,13 @@ export const configValueDeleteHook: UserDataDeleteHook = async (ctx) => {
|
|
|
39
38
|
// skip: config not mounted — its table doesn't exist, nothing to erase.
|
|
40
39
|
if (!featureMounted(ctx, "config")) return;
|
|
41
40
|
const systemUser = createSystemUser(ctx.tenantId);
|
|
42
|
-
const
|
|
43
|
-
const rows = await selectMany<Record<string, unknown>>(ctx.db, configValuesTable, {
|
|
41
|
+
const rows = await ctx.db.selectMany<Record<string, unknown>>(configValuesTable, {
|
|
44
42
|
tenantId: ctx.tenantId,
|
|
45
43
|
userId: ctx.userId,
|
|
46
44
|
});
|
|
47
45
|
for (const row of rows) {
|
|
48
46
|
const id = row["id"]; // @cast-boundary db-row
|
|
49
47
|
if (typeof id !== "string") continue;
|
|
50
|
-
assertErased(await crud.forget({ id }, systemUser,
|
|
48
|
+
assertErased(await crud.forget({ id }, systemUser, ctx.db), "config-value", id);
|
|
51
49
|
}
|
|
52
50
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
2
1
|
import type { UserDataDeleteHook, UserDataExportHook } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
2
|
import { deliveryAttemptsTable } from "../../delivery";
|
|
4
3
|
import { featureMounted } from "./feature-mounted";
|
|
@@ -11,7 +10,7 @@ import { featureMounted } from "./feature-mounted";
|
|
|
11
10
|
|
|
12
11
|
export const deliveryAttemptExportHook: UserDataExportHook = async (ctx) => {
|
|
13
12
|
if (!featureMounted(ctx, "delivery")) return null;
|
|
14
|
-
const rows = await
|
|
13
|
+
const rows = await ctx.db.selectMany(deliveryAttemptsTable, {
|
|
15
14
|
tenantId: ctx.tenantId,
|
|
16
15
|
recipientId: ctx.userId,
|
|
17
16
|
});
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
createEventStoreExecutor,
|
|
4
|
-
createTenantDb,
|
|
5
|
-
type TenantDb,
|
|
6
|
-
} from "@cosmicdrift/kumiko-framework/db";
|
|
1
|
+
import { createEventStoreExecutor, type TenantDb } from "@cosmicdrift/kumiko-framework/db";
|
|
7
2
|
import { derivativeListPrefix, isDerivativeKeyOf } from "@cosmicdrift/kumiko-framework/derivatives";
|
|
8
3
|
import {
|
|
9
4
|
createSystemUser,
|
|
@@ -69,7 +64,7 @@ const crud = createEventStoreExecutor(fileRefsTable, fileRefEntity, { entityName
|
|
|
69
64
|
export const fileRefExportHook: UserDataExportHook = async (ctx) => {
|
|
70
65
|
// isDeleted:false — soft-deleted (trashed) Files gehören nicht ins
|
|
71
66
|
// Auskunfts-Bundle. Forget (delete-Hook unten) erfasst sie trotzdem.
|
|
72
|
-
const rawRows = await
|
|
67
|
+
const rawRows = await ctx.db.selectMany(fileRefsTable, {
|
|
73
68
|
tenantId: ctx.tenantId,
|
|
74
69
|
insertedById: ctx.userId,
|
|
75
70
|
isDeleted: false,
|
|
@@ -218,8 +213,7 @@ async function severPersonLink(
|
|
|
218
213
|
|
|
219
214
|
export const fileRefDeleteHook: UserDataDeleteHook = async (ctx, strategy) => {
|
|
220
215
|
const systemUser = createSystemUser(ctx.tenantId);
|
|
221
|
-
const
|
|
222
|
-
const rows = await selectMany<Record<string, unknown>>(ctx.db, fileRefsTable, {
|
|
216
|
+
const rows = await ctx.db.selectMany<Record<string, unknown>>(fileRefsTable, {
|
|
223
217
|
tenantId: ctx.tenantId,
|
|
224
218
|
insertedById: ctx.userId,
|
|
225
219
|
});
|
|
@@ -227,7 +221,7 @@ export const fileRefDeleteHook: UserDataDeleteHook = async (ctx, strategy) => {
|
|
|
227
221
|
if (strategy !== "delete") {
|
|
228
222
|
// anonymize: insertedById=null, FileRef + binary bleiben. Use-case: shared
|
|
229
223
|
// chat-Attachment im Multi-User-Channel — Author-ID raus, Datei bleibt sichtbar.
|
|
230
|
-
await severPersonLink(
|
|
224
|
+
await severPersonLink(ctx.db, systemUser, rows);
|
|
231
225
|
// skip: anonymize is complete — the hard-delete path below runs only for strategy "delete".
|
|
232
226
|
return;
|
|
233
227
|
}
|
|
@@ -259,6 +253,6 @@ export const fileRefDeleteHook: UserDataDeleteHook = async (ctx, strategy) => {
|
|
|
259
253
|
for (const row of rows) {
|
|
260
254
|
const id = row["id"]; // @cast-boundary db-row
|
|
261
255
|
if (typeof id !== "string") continue;
|
|
262
|
-
assertErased(await crud.forget({ id }, systemUser,
|
|
256
|
+
assertErased(await crud.forget({ id }, systemUser, ctx.db), "fileRef", id);
|
|
263
257
|
}
|
|
264
258
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { deleteMany, selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
2
1
|
import type { UserDataDeleteHook, UserDataExportHook } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
2
|
import { inAppMessagesTable } from "../../channel-in-app";
|
|
4
3
|
import { featureMounted } from "./feature-mounted";
|
|
@@ -14,7 +13,7 @@ import { featureMounted } from "./feature-mounted";
|
|
|
14
13
|
|
|
15
14
|
export const inAppMessageExportHook: UserDataExportHook = async (ctx) => {
|
|
16
15
|
if (!featureMounted(ctx, "channel-in-app")) return null;
|
|
17
|
-
const rows = await
|
|
16
|
+
const rows = await ctx.db.selectMany(inAppMessagesTable, {
|
|
18
17
|
userId: ctx.userId,
|
|
19
18
|
tenantId: ctx.tenantId,
|
|
20
19
|
});
|
|
@@ -34,5 +33,5 @@ export const inAppMessageExportHook: UserDataExportHook = async (ctx) => {
|
|
|
34
33
|
export const inAppMessageDeleteHook: UserDataDeleteHook = async (ctx) => {
|
|
35
34
|
// skip: channel-in-app not mounted — its table doesn't exist, nothing to erase.
|
|
36
35
|
if (!featureMounted(ctx, "channel-in-app")) return;
|
|
37
|
-
await
|
|
36
|
+
await ctx.db.deleteMany(inAppMessagesTable, { userId: ctx.userId, tenantId: ctx.tenantId });
|
|
38
37
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
2
1
|
import type { UserDataDeleteHook, UserDataExportHook } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
2
|
import { jobRunsTable } from "../../jobs";
|
|
4
3
|
import { featureMounted } from "./feature-mounted";
|
|
@@ -11,7 +10,7 @@ import { featureMounted } from "./feature-mounted";
|
|
|
11
10
|
|
|
12
11
|
export const jobRunExportHook: UserDataExportHook = async (ctx) => {
|
|
13
12
|
if (!featureMounted(ctx, "jobs")) return null;
|
|
14
|
-
const rows = await selectMany<Record<string, unknown>>(
|
|
13
|
+
const rows = await ctx.db.selectMany<Record<string, unknown>>(jobRunsTable, {
|
|
15
14
|
triggeredById: ctx.userId,
|
|
16
15
|
});
|
|
17
16
|
if (rows.length === 0) return null;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createEventStoreExecutor, createTenantDb } from "@cosmicdrift/kumiko-framework/db";
|
|
1
|
+
import { createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
|
|
3
2
|
import {
|
|
4
3
|
createSystemUser,
|
|
5
4
|
type UserDataDeleteHook,
|
|
@@ -23,7 +22,7 @@ const crud = createEventStoreExecutor(notificationPreferencesTable, notification
|
|
|
23
22
|
|
|
24
23
|
export const notificationPreferenceExportHook: UserDataExportHook = async (ctx) => {
|
|
25
24
|
if (!featureMounted(ctx, "delivery")) return null;
|
|
26
|
-
const rows = await selectMany<Record<string, unknown>>(
|
|
25
|
+
const rows = await ctx.db.selectMany<Record<string, unknown>>(notificationPreferencesTable, {
|
|
27
26
|
tenantId: ctx.tenantId,
|
|
28
27
|
userId: ctx.userId,
|
|
29
28
|
});
|
|
@@ -42,14 +41,13 @@ export const notificationPreferenceDeleteHook: UserDataDeleteHook = async (ctx)
|
|
|
42
41
|
// skip: delivery not mounted — its table doesn't exist, nothing to erase.
|
|
43
42
|
if (!featureMounted(ctx, "delivery")) return;
|
|
44
43
|
const systemUser = createSystemUser(ctx.tenantId);
|
|
45
|
-
const
|
|
46
|
-
const rows = await selectMany<Record<string, unknown>>(ctx.db, notificationPreferencesTable, {
|
|
44
|
+
const rows = await ctx.db.selectMany<Record<string, unknown>>(notificationPreferencesTable, {
|
|
47
45
|
tenantId: ctx.tenantId,
|
|
48
46
|
userId: ctx.userId,
|
|
49
47
|
});
|
|
50
48
|
for (const row of rows) {
|
|
51
49
|
const id = row["id"]; // @cast-boundary db-row
|
|
52
50
|
if (typeof id !== "string") continue;
|
|
53
|
-
assertErased(await crud.forget({ id }, systemUser,
|
|
51
|
+
assertErased(await crud.forget({ id }, systemUser, ctx.db), "notification-preference", id);
|
|
54
52
|
}
|
|
55
53
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createEventStoreExecutor, createTenantDb } from "@cosmicdrift/kumiko-framework/db";
|
|
1
|
+
import { createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
|
|
3
2
|
import {
|
|
4
3
|
createSystemUser,
|
|
5
4
|
type UserDataDeleteHook,
|
|
@@ -41,7 +40,7 @@ const KMS_POOL_CONCURRENCY = 4;
|
|
|
41
40
|
|
|
42
41
|
async function resolveUserEmail(ctx: UserDataHookCtx): Promise<string | null> {
|
|
43
42
|
if (ctx.userEmailBeforeDelete) return ctx.userEmailBeforeDelete.toLowerCase();
|
|
44
|
-
const row = (await
|
|
43
|
+
const row = (await ctx.db.fetchOne(userTable, { id: ctx.userId })) as {
|
|
45
44
|
email: string;
|
|
46
45
|
} | null; // @cast-boundary db-runner
|
|
47
46
|
if (!row) return null;
|
|
@@ -57,7 +56,7 @@ export const tenantInvitationExportHook: UserDataExportHook = async (ctx) => {
|
|
|
57
56
|
if (!email) return null;
|
|
58
57
|
// Invitation emails are lowercase-normalized on insert, so an exact match
|
|
59
58
|
// is a case-insensitive match.
|
|
60
|
-
const rows = await selectMany<Record<string, unknown>>(
|
|
59
|
+
const rows = await ctx.db.selectMany<Record<string, unknown>>(tenantInvitationsTable, {
|
|
61
60
|
tenantId: ctx.tenantId,
|
|
62
61
|
email,
|
|
63
62
|
});
|
|
@@ -88,11 +87,10 @@ export const tenantInvitationDeleteHook: UserDataDeleteHook = async (ctx, strate
|
|
|
88
87
|
// skip: tenant not mounted — its table doesn't exist, nothing to erase.
|
|
89
88
|
if (!featureMounted(ctx, "tenant")) return;
|
|
90
89
|
const systemUser = createSystemUser(ctx.tenantId);
|
|
91
|
-
const tdb = createTenantDb(ctx.db, ctx.tenantId, "system");
|
|
92
90
|
|
|
93
91
|
const email = await resolveUserEmail(ctx);
|
|
94
92
|
if (email) {
|
|
95
|
-
const inviteeRows = await selectMany<Record<string, unknown>>(
|
|
93
|
+
const inviteeRows = await ctx.db.selectMany<Record<string, unknown>>(tenantInvitationsTable, {
|
|
96
94
|
tenantId: ctx.tenantId,
|
|
97
95
|
email,
|
|
98
96
|
});
|
|
@@ -100,14 +98,14 @@ export const tenantInvitationDeleteHook: UserDataDeleteHook = async (ctx, strate
|
|
|
100
98
|
const id = row["id"]; // @cast-boundary db-row
|
|
101
99
|
if (typeof id !== "string") continue;
|
|
102
100
|
if (strategy === "delete") {
|
|
103
|
-
assertErased(await crud.forget({ id }, systemUser,
|
|
101
|
+
assertErased(await crud.forget({ id }, systemUser, ctx.db), "tenant-invitation", id);
|
|
104
102
|
} else {
|
|
105
103
|
// Row-id in the pseudonym keeps the (tenantId, email) unique index
|
|
106
104
|
// collision-free when a user has invitations in several states.
|
|
107
105
|
await crud.update(
|
|
108
106
|
{ id, changes: { email: `forgotten-${id}@anonymized.invalid` } },
|
|
109
107
|
systemUser,
|
|
110
|
-
|
|
108
|
+
ctx.db,
|
|
111
109
|
{ skipOptimisticLock: true },
|
|
112
110
|
);
|
|
113
111
|
}
|
|
@@ -120,14 +118,14 @@ export const tenantInvitationDeleteHook: UserDataDeleteHook = async (ctx, strate
|
|
|
120
118
|
// without loading + decrypting every invitation in the tenant. See
|
|
121
119
|
// tenant/handlers/invitations.query.ts for the same lookupable-filter
|
|
122
120
|
// pattern on `email`.
|
|
123
|
-
const inviterRows = await selectMany<Record<string, unknown>>(
|
|
121
|
+
const inviterRows = await ctx.db.selectMany<Record<string, unknown>>(tenantInvitationsTable, {
|
|
124
122
|
tenantId: ctx.tenantId,
|
|
125
123
|
invitedBy: ctx.userId,
|
|
126
124
|
});
|
|
127
125
|
for (const row of inviterRows) {
|
|
128
126
|
const id = row["id"]; // @cast-boundary db-row
|
|
129
127
|
if (typeof id !== "string") continue;
|
|
130
|
-
await crud.update({ id, changes: { invitedBy: INVITED_BY_ANONYMIZED } }, systemUser,
|
|
128
|
+
await crud.update({ id, changes: { invitedBy: INVITED_BY_ANONYMIZED } }, systemUser, ctx.db, {
|
|
131
129
|
skipOptimisticLock: true,
|
|
132
130
|
});
|
|
133
131
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { deleteMany, selectMany } from "@cosmicdrift/kumiko-framework/bun-db";
|
|
2
1
|
import type { UserDataDeleteHook, UserDataExportHook } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
2
|
import { userSessionTable } from "../../sessions";
|
|
4
3
|
import { featureMounted } from "./feature-mounted";
|
|
@@ -16,7 +15,7 @@ import { featureMounted } from "./feature-mounted";
|
|
|
16
15
|
|
|
17
16
|
export const userSessionExportHook: UserDataExportHook = async (ctx) => {
|
|
18
17
|
if (!featureMounted(ctx, "sessions")) return null;
|
|
19
|
-
const rows = await
|
|
18
|
+
const rows = await ctx.db.selectMany(userSessionTable, {
|
|
20
19
|
userId: ctx.userId,
|
|
21
20
|
tenantId: ctx.tenantId,
|
|
22
21
|
});
|
|
@@ -38,5 +37,5 @@ export const userSessionExportHook: UserDataExportHook = async (ctx) => {
|
|
|
38
37
|
export const userSessionDeleteHook: UserDataDeleteHook = async (ctx) => {
|
|
39
38
|
// skip: sessions not mounted — its table doesn't exist, nothing to erase.
|
|
40
39
|
if (!featureMounted(ctx, "sessions")) return;
|
|
41
|
-
await
|
|
40
|
+
await ctx.db.deleteMany(userSessionTable, { userId: ctx.userId, tenantId: ctx.tenantId });
|
|
42
41
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createEventStoreExecutor, createTenantDb } from "@cosmicdrift/kumiko-framework/db";
|
|
1
|
+
import { createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
|
|
3
2
|
import {
|
|
4
3
|
createSystemUser,
|
|
5
4
|
type UserDataDeleteHook,
|
|
@@ -42,13 +41,13 @@ const crud = createEventStoreExecutor(userTable, userEntity, { entityName: "user
|
|
|
42
41
|
// Frist auf einer FK-target-Entity)
|
|
43
42
|
|
|
44
43
|
export const userExportHook: UserDataExportHook = async (ctx) => {
|
|
45
|
-
const row =
|
|
44
|
+
const row = await ctx.db.fetchOne<{
|
|
46
45
|
id: string;
|
|
47
46
|
email: string;
|
|
48
47
|
displayName: string;
|
|
49
48
|
locale: string | null;
|
|
50
49
|
emailVerified: boolean;
|
|
51
|
-
}
|
|
50
|
+
}>(userTable, { id: ctx.userId });
|
|
52
51
|
|
|
53
52
|
if (!row) return null;
|
|
54
53
|
|
|
@@ -75,11 +74,11 @@ export const userDeleteHook: UserDataDeleteHook = async (ctx, strategy) => {
|
|
|
75
74
|
|
|
76
75
|
// System actor + skipOptimisticLock: the forget pipeline has no read
|
|
77
76
|
// version and writes privileged identity columns ("system" is privileged).
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
//
|
|
77
|
+
// crud.update extracts the raw connection from ctx.db via tenantDbRunner
|
|
78
|
+
// and enforces global-entity tenancy itself (isForeignTenantOnGlobalEntity),
|
|
79
|
+
// so it reaches the row by id regardless of which tenant pass triggered it —
|
|
80
|
+
// TenantDb's own tenant-scoping narrowing never applies to executor writes.
|
|
81
81
|
const systemUser = createSystemUser(ctx.tenantId);
|
|
82
|
-
const tdb = createTenantDb(ctx.db, ctx.tenantId, "system");
|
|
83
82
|
|
|
84
83
|
if (strategy === "delete") {
|
|
85
84
|
// PII raus + status=deleted (Login geblockt) via Event → Rebuild spielt den
|
|
@@ -102,7 +101,7 @@ export const userDeleteHook: UserDataDeleteHook = async (ctx, strategy) => {
|
|
|
102
101
|
},
|
|
103
102
|
},
|
|
104
103
|
systemUser,
|
|
105
|
-
|
|
104
|
+
ctx.db,
|
|
106
105
|
{ skipOptimisticLock: true },
|
|
107
106
|
);
|
|
108
107
|
} else {
|
|
@@ -120,7 +119,7 @@ export const userDeleteHook: UserDataDeleteHook = async (ctx, strategy) => {
|
|
|
120
119
|
},
|
|
121
120
|
},
|
|
122
121
|
systemUser,
|
|
123
|
-
|
|
122
|
+
ctx.db,
|
|
124
123
|
{ skipOptimisticLock: true },
|
|
125
124
|
);
|
|
126
125
|
}
|