use of bio.terra.service.job.exception.JobNotFoundException in project jade-data-repo by DataBiosphere.
the class JobService method verifyUserAccess.
private void verifyUserAccess(String jobId, AuthenticatedUserRequest userReq) {
try {
FlightState flightState = stairway.getFlightState(jobId);
FlightMap inputParameters = flightState.getInputParameters();
String flightSubjectId = inputParameters.get(JobMapKeys.SUBJECT_ID.getKeyName(), String.class);
if (!StringUtils.equals(flightSubjectId, userReq.getSubjectId())) {
throw new JobUnauthorizedException("Unauthorized");
}
} catch (DatabaseOperationException ex) {
throw new InternalStairwayException("Stairway exception looking up the job", ex);
} catch (FlightNotFoundException ex) {
throw new JobNotFoundException("Job not found", ex);
} catch (InterruptedException ex) {
throw new JobServiceShutdownException("Job service interrupted", ex);
}
}
Aggregations