40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using LFlow.Base.Utils;
|
|
using LFlow.Middleware;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Routing;
|
|
using Newtonsoft.Json;
|
|
using Serilog;
|
|
|
|
namespace LFlow.UserManagement
|
|
{
|
|
/// <summary>
|
|
/// 用户管理中间件
|
|
/// </summary>
|
|
/// <param name="logger"></param>
|
|
public class UserMiddleware(ILogger logger) : ILFlowMiddleware
|
|
{
|
|
/// <summary>
|
|
/// 优先级
|
|
/// </summary>
|
|
public int Priority => 1;
|
|
/// <summary>
|
|
/// 执行入口
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <param name="next"></param>
|
|
public async Task RunAsync(Microsoft.AspNetCore.Http.HttpContext context, Func<Task> next)
|
|
{
|
|
// Do something before
|
|
// var progController = context.GetRouteData()?.Values["controller"]?.ToString();
|
|
// var progAction = context.GetRouteData()?.Values["action"]?.ToString();
|
|
// if (progAction != "ListAll")
|
|
await next();
|
|
// else
|
|
// {
|
|
// await context.Response.WriteAsync(JsonConvert.SerializeObject(ApiResult<object>.FailResult("无权限!", 100501)));
|
|
// }
|
|
// Do something after
|
|
}
|
|
}
|
|
}
|