/// <summary> /// This method helps get report info against an web request - which is executing against current context and needs to evaluate current identity /// </summary> /// <param name="reportId"></param> /// <returns></returns> public ReportInfo GetReportInfo(Guid reportId) { var report = UnitOfWork.FindAndInclude <Report>(reportId, TrackingMode.Automatic, ThrowIf.Anything, include => include.WorkflowInstance); var workflow = report.WorkflowInstance; var first = ReferenceDataHelper.GetAgencyReference(report.AgencyId); return(new ReportInfo { Agency = first ?? new AgencyReference(), IsSupplement = report.IsSupplement, ModuleType = report.ModuleType, ReportId = report.Id, Number = report.Number, TemplateId = report.TemplateId, State = report.WorkflowInstance.ReportState, WorkflowRights = WorkflowRightsFactory.Create(workflow, GetCurrentIdentity()) }); }
public DeletePreview DeleteReportPreview(Guid id) { // Find the Report var report = _reportsUoW.Find <Report>(id); // Check Authorization var rights = WorkflowRightsFactory.Create(report.WorkflowInstance, GetCurrentIdentity()); if (!rights.CanDelete) { Unauthorized("You do not have permission to Delete this Report."); } // Project the data into a preview return(new DeletePreview() { Cases = new List <CaseReference>(), Summaries = new List <SummaryReference>(), Reports = new List <ReportReference> { Projections.Report.Reference(report) } }); }