fix 控制特殊处理
This commit is contained in:
@@ -10,13 +10,22 @@ public class AssignPermissionLimitAttribute : Attribute, IAsyncActionFilter
|
||||
{
|
||||
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
|
||||
{
|
||||
var redisCache = context.HttpContext.RequestServices.GetRequiredService<RedisCache>();
|
||||
//10966 55184
|
||||
var currentUser = context.HttpContext.RequestServices.GetRequiredService<ICurrentUser>();
|
||||
var userId = currentUser.GetIntSubjectId();
|
||||
if (userId is 10966 or 55184)
|
||||
{
|
||||
await next();
|
||||
}
|
||||
else
|
||||
{
|
||||
var redisCache = context.HttpContext.RequestServices.GetRequiredService<RedisCache>();
|
||||
|
||||
var currentTenantId = currentUser.GetStringTenantId();
|
||||
var currentTenantId = currentUser.GetStringTenantId();
|
||||
|
||||
await using var handler = await redisCache.LockAsync($"permission:generate:{currentTenantId}");
|
||||
handler.Acquired.ThrowIfFalse("请勿频繁分配");
|
||||
await next();
|
||||
await using var handler = await redisCache.LockAsync($"permission:generate:{currentTenantId}");
|
||||
handler.Acquired.ThrowIfFalse("请勿频繁分配");
|
||||
await next();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user