From 8d051d2089628f7d2c5495bd58c0f59520eb60db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Wed, 27 Sep 2023 17:27:20 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudWebApi/Controllers/ProcessMapController.cs | 4 ++++ .../Controllers/ProcessMapWellboreDevelopmentController.cs | 2 +- AsbCloudWebApi/Controllers/WellOperationController.cs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/AsbCloudWebApi/Controllers/ProcessMapController.cs b/AsbCloudWebApi/Controllers/ProcessMapController.cs index 11565ba8..5cb5db64 100644 --- a/AsbCloudWebApi/Controllers/ProcessMapController.cs +++ b/AsbCloudWebApi/Controllers/ProcessMapController.cs @@ -258,6 +258,10 @@ namespace AsbCloudWebApi.Controllers if (!idUser.HasValue) return false; + var idCompany = User.GetCompanyId(); + if (!idCompany.HasValue || !await wellService.IsCompanyInvolvedInWellAsync(idCompany.Value, idWell, token)) + return false; + var well = await wellService.GetOrDefaultAsync(idWell, token); if (well is null) diff --git a/AsbCloudWebApi/Controllers/ProcessMapWellboreDevelopmentController.cs b/AsbCloudWebApi/Controllers/ProcessMapWellboreDevelopmentController.cs index 49748f14..07df4cbe 100644 --- a/AsbCloudWebApi/Controllers/ProcessMapWellboreDevelopmentController.cs +++ b/AsbCloudWebApi/Controllers/ProcessMapWellboreDevelopmentController.cs @@ -87,7 +87,7 @@ public class ProcessMapWellboreDevelopmentController : CrudWellRelatedController ?? throw new ForbidException($"Скважины с {idWell} не существует"); var idCompany = User.GetCompanyId(); - if (idCompany is not null && await wellService.IsCompanyInvolvedInWellAsync(idCompany.Value, idWell, cancellationToken)) + if (!idCompany.HasValue || !await wellService.IsCompanyInvolvedInWellAsync(idCompany.Value, idWell, cancellationToken)) throw new ForbidException("Нет доступа к скважине"); if (well.IdState == 2 && !userRepository.HasPermission(idUser, "ProcessMap.editCompletedWell")) diff --git a/AsbCloudWebApi/Controllers/WellOperationController.cs b/AsbCloudWebApi/Controllers/WellOperationController.cs index 82bc6bf6..f07ac92c 100644 --- a/AsbCloudWebApi/Controllers/WellOperationController.cs +++ b/AsbCloudWebApi/Controllers/WellOperationController.cs @@ -32,7 +32,7 @@ namespace AsbCloudWebApi.Controllers private readonly IWellOperationImportService wellOperationImportService; private readonly IUserRepository userRepository; - public WellOperationController(IWellOperationRepository operationService, + public WellOperationController(IWellOperationRepository operationRepository, IWellService wellService, IWellOperationImportTemplateService wellOperationImportTemplateService, IWellOperationExportService wellOperationExportService,