Centralizes audit column ownership in the auditing interceptor

Removes explicit audit assignments from mappings, handlers, repositories,
seeding, and background jobs, leaving the auditing interceptor as the only
writer of the audit columns for ordinary saves.

Adds a one-time initialization save so setup can attribute the original admin
account and seeded rows to the SYSTEM audit identity, while ordinary anonymous
writes remain unattributed with Guid.Empty.
This commit is contained in:
BinaryAlley committed 2026-11-21 12:00:00 +02:00
1 parent b56fabf5df
commit 7253f1507c
98 files changed
+731 -516

No files matched your search

@@ -84,8 +84,6 @@ internal static class ThemeSynchronizer
if (!string.Equals(existingTheme.Version, manifestResult.Value.Version, StringComparison.Ordinal))
{
existingTheme.Version = manifestResult.Value.Version;
existingTheme.UpdatedOnUtc = DateTime.UtcNow;
existingTheme.UpdatedBy = default;
Result<Updated> updateResult = await unitOfWork.ThemeRepository.UpdateAsync(existingTheme, cancellationToken).ConfigureAwait(false);
if (updateResult.IsFailure)
logger.LogWarning("Failed to update the version of theme '{ThemeId}': {Error}", existingTheme.ThemeId, updateResult.FirstError.Description);
@@ -103,10 +101,7 @@ internal static class ThemeSynchronizer
Version = manifestResult.Value.Version,
PreviewPath = manifestResult.Value.Preview,
InstallSource = ThemeInstallSource.Bundled,
InstalledAtUtc = DateTime.UtcNow,
CreatedOnUtc = DateTime.UtcNow,
CreatedBy = default,
UpdatedBy = default
InstalledAtUtc = DateTime.UtcNow
};
Result<Created> insertResult = await unitOfWork.ThemeRepository.InsertAsync(themeEntity, cancellationToken).ConfigureAwait(false);
@@ -174,8 +169,6 @@ internal static class ThemeSynchronizer
// A bundled theme whose files could not be recovered is soft deleted, so it is not shown anymore, but can be restored later.
brokenTheme.IsDeleted = true;
brokenTheme.IsCurrent = null;
brokenTheme.UpdatedOnUtc = DateTime.UtcNow;
brokenTheme.UpdatedBy = default;
Result<Updated> updateResult = await unitOfWork.ThemeRepository.UpdateAsync(brokenTheme, cancellationToken).ConfigureAwait(false);
if (updateResult.IsFailure)
logger.LogWarning("Failed to delete theme '{ThemeId}': {Error}", brokenTheme.ThemeId, updateResult.FirstError.Description);
@@ -227,8 +220,6 @@ internal static class ThemeSynchronizer
return;
defaultTheme.IsCurrent = true;
defaultTheme.UpdatedOnUtc = DateTime.UtcNow;
defaultTheme.UpdatedBy = default;
Result<Updated> updateResult = await unitOfWork.ThemeRepository.UpdateAsync(defaultTheme, cancellationToken).ConfigureAwait(false);
if (updateResult.IsFailure)
logger.LogWarning("Failed to activate theme '{ThemeId}': {Error}", defaultTheme.ThemeId, updateResult.FirstError.Description);