move user workload from siterouter to app component to improve performance and 404 handling

This commit is contained in:
sbwalker
2025-12-05 08:40:30 -05:00
parent 23d14c62a5
commit a51f87d743
12 changed files with 91 additions and 39 deletions

View File

@@ -192,6 +192,12 @@ namespace Oqtane.Models
[NotMapped]
public List<Theme> Themes { get; set; }
/// <summary>
/// Current user
/// </summary>
[NotMapped]
public User User { get; set; }
/// <summary>
/// fingerprint for framework static assets
/// </summary>
@@ -246,6 +252,7 @@ namespace Oqtane.Models
Pages = Pages.ConvertAll(page => page.Clone()),
Languages = Languages.ConvertAll(language => language.Clone()),
Themes = Themes,
User = User.Clone(),
Fingerprint = Fingerprint,
TenantId = TenantId
};

View File

@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Xml.Linq;
namespace Oqtane.Models
{
@@ -128,5 +130,34 @@ namespace Oqtane.Models
/// </summary>
[NotMapped]
public Dictionary<string, string> Settings { get; set; }
public User Clone()
{
return new User
{
UserId = UserId,
Username = Username,
DisplayName = DisplayName,
Email = Email,
TimeZoneId = TimeZoneId,
PhotoFileId = PhotoFileId,
LastLoginOn = LastLoginOn,
LastIPAddress = LastIPAddress,
TwoFactorRequired = TwoFactorRequired,
TwoFactorCode = TwoFactorCode,
TwoFactorExpiry = TwoFactorExpiry,
SecurityStamp = SecurityStamp,
SiteId = SiteId,
Roles = Roles,
DeletedBy = DeletedBy,
DeletedOn = DeletedOn,
IsDeleted = IsDeleted,
Password = Password,
IsAuthenticated = IsAuthenticated,
EmailConfirmed = EmailConfirmed,
SuppressNotification = SuppressNotification,
Settings = Settings.ToDictionary(setting => setting.Key, setting => setting.Value)
};
}
}
}