mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 04:11:13 -05:00
Implement Phase 2 audit logging
Add audit logging for admin settings changes, rate limit config updates, anomaly detection config changes (skipped due to no UI), and version cleanup settings updates. Implement logging via central logAdminAction helper and integrate into AdminSettings, VersionCleanupSettings, and RateLimitAlerts mutations (create, update, delete).
This commit is contained in:
@@ -68,7 +68,15 @@ export function VersionCleanupSettings() {
|
||||
|
||||
const handleSaveRetention = async () => {
|
||||
setIsSaving(true);
|
||||
const oldRetentionDays = retentionDays;
|
||||
try {
|
||||
// Get current value for audit log
|
||||
const { data: currentSetting } = await supabase
|
||||
.from('admin_settings')
|
||||
.select('setting_value')
|
||||
.eq('setting_key', 'version_retention_days')
|
||||
.single();
|
||||
|
||||
const { error } = await supabase
|
||||
.from('admin_settings')
|
||||
.update({ setting_value: retentionDays.toString() })
|
||||
@@ -76,6 +84,14 @@ export function VersionCleanupSettings() {
|
||||
|
||||
if (error) throw error;
|
||||
|
||||
// Log to audit trail
|
||||
const { logAdminAction } = await import('@/lib/adminActionAuditHelpers');
|
||||
await logAdminAction('version_cleanup_config_changed', {
|
||||
setting_key: 'version_retention_days',
|
||||
old_value: currentSetting?.setting_value,
|
||||
new_value: retentionDays,
|
||||
});
|
||||
|
||||
toast({
|
||||
title: 'Settings Saved',
|
||||
description: 'Retention period updated successfully'
|
||||
|
||||
Reference in New Issue
Block a user