权限修改
parent
655e3454a3
commit
be28ea0432
|
@ -204,7 +204,8 @@ namespace IRaCIS.Core.API
|
||||||
// 特殊异常处理 比如 404
|
// 特殊异常处理 比如 404
|
||||||
app.UseStatusCodePagesWithReExecute("/Error/{0}");
|
app.UseStatusCodePagesWithReExecute("/Error/{0}");
|
||||||
|
|
||||||
//SwaggerSetup.Configure(app, env);
|
// SwaggerÏÔÒþ
|
||||||
|
SwaggerSetup.Configure(app, env);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,13 @@ namespace IRaCIS.Core.API
|
||||||
{
|
{
|
||||||
public static class SwaggerSetup
|
public static class SwaggerSetup
|
||||||
{
|
{
|
||||||
|
public static bool useSwagger = false;
|
||||||
public static void AddSwaggerSetup(this IServiceCollection services)
|
public static void AddSwaggerSetup(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (useSwagger)
|
||||||
|
{
|
||||||
|
|
||||||
services.AddSwaggerExamplesFromAssemblyOf<JsonPatchUserRequestExample>();
|
services.AddSwaggerExamplesFromAssemblyOf<JsonPatchUserRequestExample>();
|
||||||
|
|
||||||
services.AddSwaggerGen(options =>
|
services.AddSwaggerGen(options =>
|
||||||
|
@ -89,8 +94,11 @@ namespace IRaCIS.Core.API
|
||||||
//});
|
//});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public static void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
|
{
|
||||||
|
if (useSwagger)
|
||||||
{
|
{
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
|
@ -136,7 +144,7 @@ namespace IRaCIS.Core.API
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,8 @@ namespace IRaCIS.Core.API.Middleware
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> IsValidRequest(HttpContext context)
|
private async Task<bool> IsValidRequest(HttpContext context)
|
||||||
|
{
|
||||||
|
if (!Jurisdiction.IsSearch)
|
||||||
{
|
{
|
||||||
var apiPathList = await _userTypeMenuRepository.Where(x => x.Menu.ApiPath != null && x.Menu.ApiPath != string.Empty)
|
var apiPathList = await _userTypeMenuRepository.Where(x => x.Menu.ApiPath != null && x.Menu.ApiPath != string.Empty)
|
||||||
.Select(x => new MenuApi()
|
.Select(x => new MenuApi()
|
||||||
|
@ -58,16 +60,19 @@ namespace IRaCIS.Core.API.Middleware
|
||||||
|
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
apiPathList = apiPathList.Select(x => new MenuApi()
|
Jurisdiction.MenuActionList = apiPathList.Select(x => new MenuApi()
|
||||||
{
|
{
|
||||||
UserTypeEnum = x.UserTypeEnum,
|
UserTypeEnum = x.UserTypeEnum,
|
||||||
ApiPath = x.ApiPath.ToLower(),
|
ApiPath = x.ApiPath.ToLower(),
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
Jurisdiction.IsSearch = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (_userInfo.UserTypeEnumInt != 0)
|
if (_userInfo.UserTypeEnumInt != 0)
|
||||||
{
|
{
|
||||||
var url = _userInfo.RequestUrl.ToLower(); ;
|
var url = _userInfo.RequestUrl.ToLower(); ;
|
||||||
if (apiPathList.Any(x => x.ApiPath.Contains(url)) && !apiPathList.Any(x => x.ApiPath.Contains(url) && x.UserTypeEnum == _userInfo.UserTypeEnumInt))
|
if (Jurisdiction.MenuActionList.Any(x => x.ApiPath.Contains(url)) && !Jurisdiction.MenuActionList.Any(x => x.ApiPath.Contains(url) && x.UserTypeEnum == _userInfo.UserTypeEnumInt))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,11 +102,6 @@ namespace IRaCIS.Application.Contracts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class MenuApi
|
|
||||||
{
|
|
||||||
public int UserTypeEnum { get; set; }
|
|
||||||
|
|
||||||
public string ApiPath { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,25 @@
|
||||||
using IRaCIS.Core.Domain.Models;
|
using IRaCIS.Core.Domain.Models;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Configuration.Json;
|
using Microsoft.Extensions.Configuration.Json;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Domain.Share
|
namespace IRaCIS.Core.Domain.Share
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public static class Jurisdiction
|
||||||
|
{
|
||||||
|
public static List<MenuApi> MenuActionList { get; set; }=new List<MenuApi> ();
|
||||||
|
|
||||||
|
public static bool IsSearch { get; set; } = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MenuApi
|
||||||
|
{
|
||||||
|
public int UserTypeEnum { get; set; }
|
||||||
|
|
||||||
|
public string ApiPath { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多环境 配置环境实体
|
/// 多环境 配置环境实体
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -42,6 +58,7 @@ namespace IRaCIS.Core.Domain.Share
|
||||||
public static string UserCodePrefix { get; set; }
|
public static string UserCodePrefix { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static string QCChallengeCodePrefix { get; set; }
|
public static string QCChallengeCodePrefix { get; set; }
|
||||||
|
|
||||||
public static string DicomStudyCodePrefix { get; set; }
|
public static string DicomStudyCodePrefix { get; set; }
|
||||||
|
|
Loading…
Reference in New Issue