use of org.sagebionetworks.bridge.Roles.STUDY_DESIGNER in project BridgeServer2 by Sage-Bionetworks.
the class StudyParticipantController method listParticipantReportIndices.
/* --------------------------------------------------------------- */
/* STUDY-SCOPED PARTICIPANT REPORTS */
/* --------------------------------------------------------------- */
// INDICES
@GetMapping("/v5/studies/{studyId}/participants/reports")
public ReportTypeResourceList<? extends ReportIndex> listParticipantReportIndices(@PathVariable String studyId) {
UserSession session = getAuthenticatedSession(STUDY_DESIGNER, STUDY_COORDINATOR);
// this test is done in the service, but it will miss cases where there are no
// indices. Fail faster.
CAN_READ_PARTICIPANT_REPORTS.checkAndThrow(STUDY_ID, studyId);
List<ReportIndex> list = reportService.getReportIndices(session.getAppId(), PARTICIPANT).getItems().stream().filter(index -> index.getStudyIds().contains(studyId)).collect(Collectors.toList());
return new ReportTypeResourceList<>(list, true).withRequestParam(ResourceList.STUDY_ID, studyId).withRequestParam(ResourceList.REPORT_TYPE, PARTICIPANT);
}
Aggregations