diff --git a/EnvelopeGenerator.Application/Common/Dto/UserPreferencesDto.cs b/EnvelopeGenerator.Application/Common/Dto/UserPreferencesDto.cs
index ffc794f6..3be96c21 100644
--- a/EnvelopeGenerator.Application/Common/Dto/UserPreferencesDto.cs
+++ b/EnvelopeGenerator.Application/Common/Dto/UserPreferencesDto.cs
@@ -3,7 +3,7 @@ namespace EnvelopeGenerator.Application.Common.Dto;
///
/// Represents a user's UI preferences stored in the distributed cache (dbo.TBDD_CACHE).
///
-public sealed class UserPreferencesDto
+public sealed record UserPreferencesDto
{
///
/// The active DevExpress theme name.
@@ -23,4 +23,17 @@ public sealed class UserPreferencesDto
/// Values are opaque JSON strings produced by DxGrid.SaveLayoutAsync().
///
public Dictionary GridLayouts { get; set; } = new();
+
+ ///
+ /// The authenticated user's display name ("{GivenName} {Surname}").
+ /// Populated by the server on GET responses from JWT claims.
+ /// NOT persisted in cache — injected at read time by UserPreferencesController.
+ /// Ignored on PUT requests.
+ ///
+ public string? DisplayName { get; set; }
+
+ ///
+ ///
+ ///
+ public static UserPreferencesDto Default { get; } = new UserPreferencesDto();
}
diff --git a/EnvelopeGenerator.Application/Common/Interfaces/Services/IUserPreferencesService.cs b/EnvelopeGenerator.Application/Common/Interfaces/Services/IUserPreferencesService.cs
index 015e6670..9103886e 100644
--- a/EnvelopeGenerator.Application/Common/Interfaces/Services/IUserPreferencesService.cs
+++ b/EnvelopeGenerator.Application/Common/Interfaces/Services/IUserPreferencesService.cs
@@ -14,16 +14,16 @@ public interface IUserPreferencesService
/// Always returns a valid object — never throws, never returns null.
/// Returns defaults if no entry exists in cache.
///
- /// The sender's username (ClaimTypes.Name from JWT).
+ ///
/// Cancellation token.
- Task GetAsync(string username, CancellationToken ct = default);
+ Task GetOrCreateAsync(string id, CancellationToken ct = default);
///
/// Persists the given preferences for the user in the distributed cache.
/// Failures are non-fatal and silently ignored.
///
- /// The sender's username (ClaimTypes.Name from JWT).
+ ///
/// The preferences to persist.
/// Cancellation token.
- Task SaveAsync(string username, UserPreferencesDto preferences, CancellationToken ct = default);
+ Task SaveAsync(string id, UserPreferencesDto preferences, CancellationToken ct = default);
}
diff --git a/EnvelopeGenerator.Domain/Constants/Role.cs b/EnvelopeGenerator.Domain/Constants/Role.cs
index 0a85a9bc..b6347dee 100644
--- a/EnvelopeGenerator.Domain/Constants/Role.cs
+++ b/EnvelopeGenerator.Domain/Constants/Role.cs
@@ -1,5 +1,6 @@
#if NETFRAMEWORK
using System;
+using System.Collections.Generic;
#endif
namespace EnvelopeGenerator.Domain.Constants
@@ -15,7 +16,11 @@ namespace EnvelopeGenerator.Domain.Constants
public static class Receiver
{
public const string TFA = "EGReceiverTFA";
+
+ [Obsolete("Use Receiver.Authorized")]
public const string Full = "EGReceiver";
+
+ public static readonly IReadOnlyList Authorized = new[] { "receiver", "EGReceiver" };
}
public const string Sender = "EGSender";