修改IsAdmin方法

This commit is contained in:
不做码农 2022-10-25 07:52:03 +08:00
parent a68788bdba
commit e7c4efad1d

View File

@ -1,4 +1,5 @@
using Infrastructure.Extensions; using Infrastructure;
using Infrastructure.Extensions;
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
@ -95,8 +96,8 @@ namespace ZR.Admin.WebApi.Extensions
/// <returns></returns> /// <returns></returns>
public static bool IsAdmin(this HttpContext context) public static bool IsAdmin(this HttpContext context)
{ {
long id = GetUId(context); var userName = GetName(context);
return id == 1; return userName == GlobalConstant.AdminRole;
} }
/// <summary> /// <summary>