diff --git a/src/ThingsGateway.Web.Core/Handlers/BlazorAuthorizeHandler.cs b/src/ThingsGateway.Web.Core/Handlers/BlazorAuthorizeHandler.cs index 56582f039..7e614154b 100644 --- a/src/ThingsGateway.Web.Core/Handlers/BlazorAuthorizeHandler.cs +++ b/src/ThingsGateway.Web.Core/Handlers/BlazorAuthorizeHandler.cs @@ -66,7 +66,9 @@ namespace ThingsGateway.Web.Core // 此处已经自动验证 Jwt Verificat的有效性了,无需手动验证 // 路由名称 var routeName = httpContext.Request.Path.Value; - if (user.PermissionCodeList?.Contains(routeName) == true)//如果当前路由信息不包含在角色授权路由列表中则认证失败 + var isRolePermission = httpContext.GetMetadata(); + + if (isRolePermission==null||user.PermissionCodeList?.Contains(routeName) == true)//如果当前路由信息不包含在角色授权路由列表中则认证失败 return true; else return false; diff --git a/src/ThingsGateway.Web.Foundation/Controllers/CollectDbInfoControler.cs b/src/ThingsGateway.Web.Foundation/Controllers/CollectDbInfoControler.cs new file mode 100644 index 000000000..ce26ec598 --- /dev/null +++ b/src/ThingsGateway.Web.Foundation/Controllers/CollectDbInfoControler.cs @@ -0,0 +1,49 @@ +using Furion.DynamicApiController; + +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +using NewLife; + +using System.Linq; + +using ThingsGateway.Core; +using ThingsGateway.Core.Extension; + +namespace ThingsGateway.Web.Foundation +{ + /// + /// 采集设备 + /// + [ApiDescriptionSettings(CateGoryConst.ThingsGatewayOpenApi, Order = 200)] + [Route("openApi/collectdbInfo")] + [Description("获取配置信息")] + [LoggingMonitor] + [Authorize(AuthenticationSchemes = "Bearer")] + public class CollectDbInfoControler : IDynamicApiController + { + IServiceScopeFactory _scopeFactory; + IVariableService _variableService { get; set; } + public CollectDbInfoControler(IServiceScopeFactory scopeFactory,IVariableService variableService) + { + _scopeFactory = scopeFactory; + _variableService = variableService; + } + + /// + /// 获取变量信息 + /// + /// + [HttpGet("variableList")] + [Description("获取变量信息")] + public async Task> GetVariableList([FromQuery] VariablePageInput input) + { + var data = await _variableService.Page(input); + + return data; + } + + + } +} +