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,