XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEExtension.NetCore.ServerInteractive

[DLL] Server interaction extension, including user identity verification and querying in conjunction with AutoConfig

公开
关注 0 Fork 0 Star 0
UTF-8
using XFEExtension.NetCore.ServerInteractive.Interfaces;

namespace XFEExtension.NetCore.ServerInteractive.Models.UserModels;

/// <summary>可安全返回给客户端的用户 DTO,不包含密码、盐、哈希或会话。</summary>
public sealed class UserPublicDto : IUserFaceInfo
{
    public string Id { get; set; } = string.Empty;
    public long Version { get; set; }
    public string NickName { get; set; } = string.Empty;
    public int PermissionLevel { get; set; }
    public string UserName { get; set; } = string.Empty;
    public bool Enable { get; set; }

    public static UserPublicDto From(IUserInfo user) => new()
    {
        Id = user.Id,
        Version = user.Version,
        NickName = user.NickName,
        PermissionLevel = user.PermissionLevel,
        UserName = user.UserName,
        Enable = user.Enable
    };
}