new features
This commit is contained in:
@@ -241,7 +241,17 @@ class AuditService {
|
|||||||
if (admins.length === 0) return;
|
if (admins.length === 0) return;
|
||||||
|
|
||||||
const titel = sensitiveActions[entry.action] || 'Benutzer-Änderung';
|
const titel = sensitiveActions[entry.action] || 'Benutzer-Änderung';
|
||||||
const nachricht = `${entry.action} auf ${entry.resource_type}${entry.resource_id ? ' ' + entry.resource_id : ''} durch ${entry.user_email ?? 'System'}`;
|
|
||||||
|
let nachricht: string;
|
||||||
|
if (entry.action === 'PERMISSION_DENIED') {
|
||||||
|
const meta = entry.metadata as Record<string, unknown> | undefined;
|
||||||
|
const perm = meta?.required_permission ?? '?';
|
||||||
|
const path = meta?.attempted_path ?? '';
|
||||||
|
const method = meta?.attempted_method ?? '';
|
||||||
|
nachricht = `${entry.user_email ?? 'Unbekannt'}: ${method} ${path} — benötigt "${perm}"`;
|
||||||
|
} else {
|
||||||
|
nachricht = `${entry.action} auf ${entry.resource_type}${entry.resource_id ? ' ' + entry.resource_id : ''} durch ${entry.user_email ?? 'System'}`;
|
||||||
|
}
|
||||||
|
|
||||||
for (const admin of admins) {
|
for (const admin of admins) {
|
||||||
// Don't notify the admin about their own actions
|
// Don't notify the admin about their own actions
|
||||||
|
|||||||
Reference in New Issue
Block a user