Skip to content

Commit 382f363

Browse files
committed
Fix: list only workspaces owned by the logged user
- right now all workspaces are listed to which a user has access to. Which means the user can open a project on a workspace he does not own. - resolves #53
1 parent 582b789 commit 382f363

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
## [Unreleased]
66
### Fixed
77
- `Recent Coder Workspaces` label overlaps with the search bar in the `Connections` view
8-
- working Workspaces are now listed when there are issues with resolving agents
8+
- working Workspaces are now listed when there are issues with resolving agents
9+
- list only workspaces owned by the logged user
910

1011
### Changed
1112
- links to documentation now point to the latest Coder OSS

src/main/kotlin/com/coder/gateway/sdk/CoderRestClientService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class CoderRestClientService {
8080
* @throws WorkspaceResponseException if workspaces could not be retrieved.
8181
*/
8282
fun workspaces(): List<Workspace> {
83-
val workspacesResponse = retroRestClient.workspaces().execute()
83+
val workspacesResponse = retroRestClient.workspaces("owner:me").execute()
8484
if (!workspacesResponse.isSuccessful) {
8585
throw WorkspaceResponseException("Could not retrieve Coder Workspaces:${workspacesResponse.code()}, reason: ${workspacesResponse.message()}")
8686
}

src/main/kotlin/com/coder/gateway/sdk/v2/CoderV2RestFacade.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.coder.gateway.sdk.v2.models.WorkspaceResource
77
import retrofit2.Call
88
import retrofit2.http.GET
99
import retrofit2.http.Path
10+
import retrofit2.http.Query
1011
import java.util.UUID
1112

1213
interface CoderV2RestFacade {
@@ -21,7 +22,7 @@ interface CoderV2RestFacade {
2122
* Retrieves all workspaces the authenticated user has access to.
2223
*/
2324
@GET("api/v2/workspaces")
24-
fun workspaces(): Call<List<Workspace>>
25+
fun workspaces(@Query("q") searchParams: String): Call<List<Workspace>>
2526

2627
@GET("api/v2/buildinfo")
2728
fun buildInfo(): Call<BuildInfo>

0 commit comments

Comments
 (0)