use of org.eclipse.che.api.workspace.server.token.MachineAccessForbidden in project che-server by eclipse-che.
the class WorkspaceService method asDtoWithLinksAndToken.
private WorkspaceDto asDtoWithLinksAndToken(WorkspaceImpl workspace) throws ServerException {
WorkspaceDto workspaceDto = asDto(workspace).withLinks(linksGenerator.genLinks(workspace, getServiceContext()));
RuntimeDto runtimeDto = workspaceDto.getRuntime();
if (runtimeDto != null) {
try {
runtimeDto.setMachineToken(machineTokenProvider.getToken(workspace.getId()));
} catch (MachineAccessForbidden e) {
// set runtime to null since user doesn't have the required permissions
workspaceDto.setRuntime(null);
} catch (MachineTokenException e) {
throw new ServerException(e.getMessage(), e);
}
}
return workspaceDto;
}
use of org.eclipse.che.api.workspace.server.token.MachineAccessForbidden in project devspaces-images by redhat-developer.
the class WorkspaceService method asDtoWithLinksAndToken.
private WorkspaceDto asDtoWithLinksAndToken(WorkspaceImpl workspace) throws ServerException {
WorkspaceDto workspaceDto = asDto(workspace).withLinks(linksGenerator.genLinks(workspace, getServiceContext()));
RuntimeDto runtimeDto = workspaceDto.getRuntime();
if (runtimeDto != null) {
try {
runtimeDto.setMachineToken(machineTokenProvider.getToken(workspace.getId()));
} catch (MachineAccessForbidden e) {
// set runtime to null since user doesn't have the required permissions
workspaceDto.setRuntime(null);
} catch (MachineTokenException e) {
throw new ServerException(e.getMessage(), e);
}
}
return workspaceDto;
}
Aggregations