IAuthSessionAppService.cs
2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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>
/// 非 SaaS(<c>EnabledSaasMultiTenancy=false</c>)且用户名为 <c>admin</c> 时返回全部未删除菜单(与 <c>AccountService.GetVue3Router</c> 行为对齐)。
/// SaaS 开启时:平台主库登录(JWT / <c>__tenant</c> 无业务租户 Id,含全 0)即使用户名为 <c>admin</c> 也仅返回平台菜单
/// (<c>PermissionCode</c> 以 <c>menu.platform</c> 开头或 <c>Router</c> 以 <c>/platform</c> 开头,含祖先节点以成树);
/// 公司业务租户登录时即使用户名为 <c>admin</c> 也按 RoleMenu 关联查询,与 <c>UpdateCompanyMenus</c> 同步的管理员菜单权限一致。
/// 返回体额外包含:<c>userId</c>(当前登录用户 Id,与 <c>user.id</c> 一致,非租户 Id)、<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();
}