Search in sources :

Example 1 with WorkspaceResponseListResponse

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);
}
Also used : ShareWorkspaceResponse(org.pmiops.workbench.model.ShareWorkspaceResponse) CloneWorkspaceResponse(org.pmiops.workbench.model.CloneWorkspaceResponse) WorkspaceResponse(org.pmiops.workbench.model.WorkspaceResponse) User(org.pmiops.workbench.db.model.User) WorkspaceResponseListResponse(org.pmiops.workbench.model.WorkspaceResponseListResponse) ArrayList(java.util.ArrayList) WorkspaceUserRole(org.pmiops.workbench.db.model.WorkspaceUserRole)

Aggregations

ArrayList (java.util.ArrayList)1 User (org.pmiops.workbench.db.model.User)1 WorkspaceUserRole (org.pmiops.workbench.db.model.WorkspaceUserRole)1 CloneWorkspaceResponse (org.pmiops.workbench.model.CloneWorkspaceResponse)1 ShareWorkspaceResponse (org.pmiops.workbench.model.ShareWorkspaceResponse)1 WorkspaceResponse (org.pmiops.workbench.model.WorkspaceResponse)1 WorkspaceResponseListResponse (org.pmiops.workbench.model.WorkspaceResponseListResponse)1