live-forum/server/webapi/LiveForum/LiveForum.IService/Permission/IPermissionService.cs
2026-03-24 11:27:37 +08:00

29 lines
1.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using LiveForum.Model.Dto.Permission;
using LiveForum.Model.Enum;
using System.Threading.Tasks;
namespace LiveForum.IService.Permission
{
/// <summary>
/// 权限服务接口 - 计算用户有效权限、校验单项权限
/// </summary>
public interface IPermissionService
{
/// <summary>
/// 获取用户的有效权限集合
/// 有效权限 = SK认证等级权限 所有身份组权限(任一来源允许即允许)
/// </summary>
/// <param name="userId">用户ID</param>
/// <returns>用户的有效权限DTO</returns>
Task<EffectivePermissionDto> GetEffectivePermissionAsync(long userId);
/// <summary>
/// 校验用户是否拥有指定权限,无权限时抛出 MessageBox 异常ResponseCode.Forbidden
/// </summary>
/// <param name="userId">用户ID</param>
/// <param name="permissionType">要校验的权限类型</param>
Task CheckPermissionAsync(long userId, PermissionType permissionType);
}
}