IAuthSessionAppService.cs 1.71 KB
using FoodLabeling.Application.Contracts.Dtos.AuthSession;
using Volo.Abp.Application.Services;

namespace FoodLabeling.Application.Contracts.IServices;

/// <summary>
/// 当前登录会话:菜单权限与退出(美国版 Web 管理端)
/// </summary>
public interface IAuthSessionAppService : IApplicationService
{
    /// <summary>
    /// 获取当前登录用户的角色编码、权限码与可见菜单树
    /// </summary>
    /// <remarks>
    /// 与框架 <c>UserManager.GetInfoAsync</c> 一致;用户名为 <c>admin</c> 时返回全部未删除菜单(与 <c>AccountService.GetVue3Router</c> 行为对齐)。
    /// 返回体额外包含:<c>lastUpdated</c>(用户 LastModificationTime)、<c>role</c>(角色展示名,多角色英文逗号拼接)、<c>fullName</c>(姓名优先,其次昵称、用户名)。
    /// 角色名通过 <c>Role</c> 表直查(<c>RoleDbEntity</c>),避免走仓储 IDataPermission。
    /// </remarks>
    /// <returns>用户简要信息、权限码与菜单树</returns>
    /// <response code="200">成功</response>
    /// <response code="401">未登录或令牌无效</response>
    /// <response code="500">服务器错误</response>
    Task<CurrentUserMenuPermissionsOutputDto> GetMyMenusAsync();

    /// <summary>
    /// 退出登录:清除服务端用户信息缓存(JWT 仍由前端丢弃)
    /// </summary>
    /// <remarks>
    /// 与框架 <c>AccountService.PostLogout</c> 一致;未登录时返回 <c>false</c>。
    /// </remarks>
    /// <returns>是否执行了缓存清理(已登录为 true)</returns>
    /// <response code="200">成功</response>
    /// <response code="500">服务器错误</response>
    Task<bool> LogoutAsync();
}