move user workload from siterouter to app component to improve performance and 404 handling
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
@@ -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)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user