use of bio.terra.workspace.service.job.exception.JobNotFoundException in project terra-workspace-manager by DataBiosphere.
the class JobService method verifyUserAccess.
/**
* Ensure the user in the user request has permission to read the workspace associated with the
* Job ID. Throws ForbiddenException if not.
*
* @param jobId - ID of running job
* @param userRequest - original user request
*/
private void verifyUserAccess(String jobId, AuthenticatedUserRequest userRequest) {
try {
FlightState flightState = stairwayComponent.get().getFlightState(jobId);
FlightMap inputParameters = flightState.getInputParameters();
UUID workspaceId = inputParameters.get(WorkspaceFlightMapKeys.WORKSPACE_ID, UUID.class);
flightBeanBag.getWorkspaceService().validateWorkspaceAndAction(userRequest, workspaceId, SamWorkspaceAction.READ);
} catch (DatabaseOperationException | InterruptedException ex) {
throw new InternalStairwayException("Stairway exception looking up the job", ex);
} catch (FlightNotFoundException ex) {
throw new JobNotFoundException("Job not found", ex);
}
}
Aggregations