public async Task <Report> ValidateAndReturnReport(string reportId, params ReportPermission[] permissions)
        {
            var report = await reportService.GetReport(reportId) ??
                         throw new EntityNotFoundException("Report not found");

            return(await reportValidationService.IsUserReportMember(httpContextReader.CurrentUserId, report) &&
                   await reportValidationService.ValidatePermissions(httpContextReader.CurrentUserId, report,
                                                                     permissions)
                ? report
                : throw new NoPermissionsException(ErrorMessages.NotAllowedMessage));
        }
Esempio n. 2
0
 public async Task <GetReportResponse> Handle(GetReportRequest request, CancellationToken cancellationToken)
 => new GetReportResponse
 {
     Report = mapper.Map <ReportDto>(await reportService.GetReport(request.ReportId))
 };