mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-20 10:50:48 +08:00
更正:不存在OpenApi授权特性时直接通过授权
This commit is contained in:
@@ -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<OpenApiPermissionAttribute>();
|
||||
|
||||
if (isRolePermission==null||user.PermissionCodeList?.Contains(routeName) == true)//如果当前路由信息不包含在角色授权路由列表中则认证失败
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 采集设备
|
||||
/// </summary>
|
||||
[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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取变量信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("variableList")]
|
||||
[Description("获取变量信息")]
|
||||
public async Task<SqlSugarPagedList<CollectDeviceVariable>> GetVariableList([FromQuery] VariablePageInput input)
|
||||
{
|
||||
var data = await _variableService.Page(input);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user