forked from ddrilling/AsbCloudServer
#5998816 PermissionToSetPubliher and PermissionToUpload
This commit is contained in:
parent
5b9afa09fa
commit
7918bfc678
@ -17,6 +17,11 @@ namespace AsbCloudApp.Data
|
||||
/// </summary>
|
||||
public int IdWell { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Разрешение для текущего пользователя добавлять ответственных
|
||||
/// </summary>
|
||||
public bool PermissionToSetPubliher { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Документ дела скважины
|
||||
/// </summary>
|
||||
|
@ -19,6 +19,11 @@ namespace AsbCloudApp.Data
|
||||
/// </summary>
|
||||
public string NameCategory { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Разрешение для текущего пользователя загружать документ
|
||||
/// </summary>
|
||||
public bool PermissionToUpload { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Список ответственных
|
||||
/// </summary>
|
||||
|
@ -25,9 +25,10 @@ namespace AsbCloudApp.Services
|
||||
/// Получение всех записей
|
||||
/// </summary>
|
||||
/// <param name = "idWell" ></param >
|
||||
/// <param name = "idUser" ></param >
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<WellCaseDto> GetByWellId(int idWell, CancellationToken token);
|
||||
Task<WellCaseDto> GetByWellId(int idWell, int idUser, CancellationToken token);
|
||||
|
||||
/// <summary>
|
||||
/// Получение списка ответственных
|
||||
|
@ -77,7 +77,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
throw new ArgumentInvalidException("Данные по категориям отсутствуют.");
|
||||
}
|
||||
|
||||
public async Task<WellCaseDto> GetByWellId(int idWell, CancellationToken token)
|
||||
public async Task<WellCaseDto> GetByWellId(int idWell, int idUser, CancellationToken token)
|
||||
{
|
||||
var wellFinalDocuments = new List<WellFinalDocumentDto>();
|
||||
|
||||
@ -121,12 +121,15 @@ namespace AsbCloudInfrastructure.Services
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
var publishers = allUsers.Where(x => userIds.Contains(x.Id));
|
||||
|
||||
wellFinalDocuments.Add(new WellFinalDocumentDto {
|
||||
IdCategory = item.IdCategory,
|
||||
NameCategory = item.NameCategory,
|
||||
Publishers = allUsers.Where(x => userIds.Contains(x.Id)),
|
||||
Publishers = publishers,
|
||||
FilesCount = allFiles.Count(),
|
||||
File = actualFile
|
||||
File = actualFile,
|
||||
PermissionToUpload = publishers.Any(x => x.Id == idUser)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -42,7 +42,8 @@ namespace AsbCloudWebApi.Controllers
|
||||
if (idCompany is null || !await wellService.IsCompanyInvolvedInWellAsync(idCompany ?? default, idWell, token).ConfigureAwait(false))
|
||||
return Forbid();
|
||||
|
||||
var data = await this.wellFinalDocumentsService.GetByWellId(idWell, token);
|
||||
var idUser = User?.GetUserId();
|
||||
var data = await this.wellFinalDocumentsService.GetByWellId(idWell, idUser ?? default, token);
|
||||
return Ok(data);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user