mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
Add audit events for account actions, server and application settings, services, destinations, storage, backup schedules, and scheduled tasks. Track changed fields and skip unchanged saves without logging file content. Add regression coverage for audit events and changed-field detection.
32 lines
854 B
PHP
32 lines
854 B
PHP
<?php
|
|
|
|
namespace App\Traits;
|
|
|
|
use App\Models\Application;
|
|
|
|
trait AuditsApplicationSettings
|
|
{
|
|
/**
|
|
* Save the application's settings and record `ui.application.settings_updated` with the
|
|
* names of the changed fields. Nothing is recorded when no setting changed.
|
|
*/
|
|
private function saveApplicationSettingsWithAudit(Application $application): void
|
|
{
|
|
$settings = $application->settings;
|
|
$changedFields = auditChangedFields($settings);
|
|
|
|
$settings->save();
|
|
|
|
if ($changedFields === []) {
|
|
return;
|
|
}
|
|
|
|
auditLog('ui.application.settings_updated', [
|
|
'team_id' => $application->team()?->id,
|
|
'application_uuid' => $application->uuid,
|
|
'application_name' => $application->name,
|
|
'changed_fields' => $changedFields,
|
|
]);
|
|
}
|
|
}
|