use of org.pmiops.workbench.model.WorkspaceResponseListResponse in project workbench by all-of-us.
the class WorkspacesController method getWorkspaces.
@Override
public ResponseEntity<WorkspaceResponseListResponse> getWorkspaces() {
// TODO: use FireCloud to determine what workspaces to return, instead of just returning
// workspaces from our database.
User user = userProvider.get();
List<WorkspaceResponse> responseList = new ArrayList<WorkspaceResponse>();
if (user != null) {
for (WorkspaceUserRole userRole : user.getWorkspaceUserRoles()) {
// TODO: Use FireCloud to determine access roles, not our DB
WorkspaceResponse currentWorkspace = new WorkspaceResponse();
currentWorkspace.setWorkspace(TO_CLIENT_WORKSPACE.apply(userRole.getWorkspace()));
currentWorkspace.setAccessLevel(userRole.getRole());
responseList.add(currentWorkspace);
}
}
WorkspaceResponseListResponse response = new WorkspaceResponseListResponse();
response.setItems(responseList);
return ResponseEntity.ok(response);
}
Aggregations