修改权限
parent
825e2c3740
commit
b6e5bd91f9
|
@ -242,6 +242,7 @@ namespace IRaCIS.Core.API.Controllers
|
|||
/// <returns></returns>
|
||||
[HttpPost, Route("Inspection/configTrialBasicInfo/ConfigTrialBasicInfoConfirm")]
|
||||
[UnitOfWork]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt" })]
|
||||
public async Task<IResponseOutput> ConfigTrialBasicInfoConfirm(DataInspectionDto<BasicTrialConfig> opt)
|
||||
{
|
||||
|
||||
|
@ -261,6 +262,7 @@ namespace IRaCIS.Core.API.Controllers
|
|||
/// <returns></returns>
|
||||
[HttpPost, Route("Inspection/configTrialBasicInfo/ConfigTrialProcessInfoConfirm")]
|
||||
[UnitOfWork]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt" })]
|
||||
public async Task<IResponseOutput> ConfigTrialProcessInfoConfirm(DataInspectionDto<TrialProcessConfig> opt)
|
||||
{
|
||||
opt.Data.IsTrialProcessConfirmed = true;
|
||||
|
@ -282,6 +284,7 @@ namespace IRaCIS.Core.API.Controllers
|
|||
/// <returns></returns>
|
||||
[HttpPost, Route("Inspection/configTrialBasicInfo/ConfigTrialUrgentInfoConfirm")]
|
||||
[UnitOfWork]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt" })]
|
||||
public async Task<IResponseOutput> ConfigTrialUrgentInfoConfirm(DataInspectionDto<TrialUrgentConfig> opt)
|
||||
{
|
||||
opt.Data.IsTrialUrgentConfirmed = true;
|
||||
|
|
|
@ -3,6 +3,7 @@ using IRaCIS.Core.Domain.Share;
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using static IRaCIS.Core.Domain.Share.StaticData;
|
||||
|
||||
namespace IRaCIS.Core.Application.Filter
|
||||
{
|
||||
|
@ -14,11 +15,14 @@ namespace IRaCIS.Core.Application.Filter
|
|||
private readonly IEasyCachingProvider _provider;
|
||||
private readonly IUserInfo _userInfo;
|
||||
|
||||
private readonly string _trialOpt;
|
||||
|
||||
public TrialResourceFilter(IEasyCachingProvider provider, IUserInfo userInfo)
|
||||
|
||||
public TrialResourceFilter(IEasyCachingProvider provider, IUserInfo userInfo, string trialOpt)
|
||||
{
|
||||
_provider = provider;
|
||||
_userInfo = userInfo;
|
||||
_trialOpt = trialOpt;
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,7 +102,7 @@ namespace IRaCIS.Core.Application.Filter
|
|||
var trialStatusStr = cacheResultDic[trialIdStr];
|
||||
|
||||
// 这里是统一拦截 项目有关的操作允许情况(特殊的地方,比如项目配置(有的在多种状态(初始化,ongoing)都可以操作,有的仅仅在Initializing)还有 项目添加和更新,不走这里,特殊处理,不然在这里显得很乱,判断是哪个接口)
|
||||
if (trialStatusStr.Value == StaticData.TrialState.TrialOngoing)
|
||||
if (trialStatusStr.Value == StaticData.TrialState.TrialOngoing || _trialOpt==TrialOpt.BeforeOngoingCantOpt)
|
||||
{
|
||||
|
||||
await next.Invoke();
|
||||
|
|
|
@ -15,6 +15,7 @@ using IRaCIS.Core.Application.Interfaces;
|
|||
using IRaCIS.Core.Application.ViewModel;
|
||||
using MassTransit;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using static IRaCIS.Core.Domain.Share.StaticData;
|
||||
|
||||
namespace IRaCIS.Core.Application
|
||||
{
|
||||
|
@ -648,7 +649,7 @@ namespace IRaCIS.Core.Application
|
|||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[Authorize(Policy = IRaCISPolicy.PM_APM)]
|
||||
//[TypeFilter(typeof(TrialResourceFilter))]
|
||||
|
||||
public async Task<IResponseOutput> ConfigTrialBasicInfo(BasicTrialConfig trialConfig)
|
||||
{
|
||||
await VerifyOnlyInOngoingOrInitialIzingOptAsync(trialConfig.TrialId);
|
||||
|
@ -672,7 +673,7 @@ namespace IRaCIS.Core.Application
|
|||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[Authorize(Policy = IRaCISPolicy.PM_APM)]
|
||||
//[TypeFilter(typeof(TrialResourceFilter))]
|
||||
|
||||
public async Task<IResponseOutput> ConfigTrialProcessInfo(TrialProcessConfig trialConfig)
|
||||
{
|
||||
if (!await _trialRepository.Where(t => t.Id == trialConfig.TrialId).IgnoreQueryFilters().AnyAsync(t => t.TrialStatusStr == StaticData.TrialState.TrialInitializing))
|
||||
|
@ -746,7 +747,6 @@ namespace IRaCIS.Core.Application
|
|||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[Authorize(Policy = IRaCISPolicy.PM_APM)]
|
||||
//[TypeFilter(typeof(TrialResourceFilter))]
|
||||
public async Task<IResponseOutput> ConfigTrialUrgentInfo(TrialUrgentConfig trialConfig)
|
||||
{
|
||||
|
||||
|
@ -881,7 +881,6 @@ namespace IRaCIS.Core.Application
|
|||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取 配置的所有信息 没有分多个接口
|
||||
/// </summary>
|
||||
|
@ -895,18 +894,13 @@ namespace IRaCIS.Core.Application
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 配置项目任务信息
|
||||
/// </summary>
|
||||
/// <param name="trialConfig"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
//[TypeFilter(typeof(TrialResourceFilter))]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt" })]
|
||||
public async Task<IResponseOutput> ConfigTrialTaskInfo(TrialTaskConfig trialConfig)
|
||||
{
|
||||
var trialInfo = (await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialConfig.TrialId)).IfNullThrowException();
|
||||
|
@ -923,7 +917,7 @@ namespace IRaCIS.Core.Application
|
|||
/// <param name="trialConfig"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
//[TypeFilter(typeof(TrialResourceFilter))]
|
||||
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "BeforeOngoingCantOpt" })]
|
||||
public async Task<IResponseOutput> ConfigTrialReadingTaskViewRule(TrialReadingTaskViewConfig trialConfig)
|
||||
{
|
||||
var trialInfo = (await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialConfig.TrialId)).IfNullThrowException();
|
||||
|
|
|
@ -89,6 +89,7 @@ namespace IRaCIS.Application.Services
|
|||
[UnitOfWork]
|
||||
[HttpPost]
|
||||
[Authorize(Policy = IRaCISPolicy.PM_APM)]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt" })]
|
||||
public async Task<IResponseOutput> AddOrUpdateVisitStage(VisitPlanCommand visitPlan)
|
||||
{
|
||||
|
||||
|
@ -190,6 +191,7 @@ namespace IRaCIS.Application.Services
|
|||
[UnitOfWork]
|
||||
[HttpPost("{trialId:guid}")]
|
||||
[Authorize(Policy = IRaCISPolicy.PM_APM)]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt" })]
|
||||
public async Task<IResponseOutput> ConfirmTrialVisitPlan(Guid trialId)
|
||||
{
|
||||
if (!await _trialRepository.AnyAsync(t => t.Id == trialId && (t.TrialStatusStr == StaticData.TrialState.TrialInitializing || t.TrialStatusStr == StaticData.TrialState.TrialOngoing)))
|
||||
|
|
|
@ -50,6 +50,15 @@ public static class StaticData
|
|||
}
|
||||
|
||||
|
||||
|
||||
public static class TrialOpt
|
||||
{
|
||||
//默认
|
||||
public static readonly string AfterStopCannNotOpt = "AfterStopCannNotOpt";
|
||||
|
||||
//ongoing 前能操作
|
||||
public static readonly string BeforeOngoingCantOpt = "BeforeOngoingCantOpt";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue