-
Notifications
You must be signed in to change notification settings - Fork 939
feat: Single query for all workspaces with optional filter #1537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c18b162
f0bf934
817bae1
8cc4a2c
67423fb
ba3f15d
3142a22
c1bb602
32cf21f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,6 @@ func TestAuthorizeAllEndpoints(t *testing.T) { | |
"GET:/api/v2/workspaceagents/me/metadata": {NoAuthorize: true}, | ||
"GET:/api/v2/workspaceagents/me/turn": {NoAuthorize: true}, | ||
"GET:/api/v2/workspaceagents/{workspaceagent}": {NoAuthorize: true}, | ||
"GET:/api/v2/workspaceagents/{workspaceagent}/": {NoAuthorize: true}, | ||
"GET:/api/v2/workspaceagents/{workspaceagent}/dial": {NoAuthorize: true}, | ||
"GET:/api/v2/workspaceagents/{workspaceagent}/iceservers": {NoAuthorize: true}, | ||
"GET:/api/v2/workspaceagents/{workspaceagent}/pty": {NoAuthorize: true}, | ||
|
@@ -95,7 +94,6 @@ func TestAuthorizeAllEndpoints(t *testing.T) { | |
|
||
"GET:/api/v2/users/oauth2/github/callback": {NoAuthorize: true}, | ||
|
||
"POST:/api/v2/users/{user}/organizations/": {NoAuthorize: true}, | ||
"PUT:/api/v2/organizations/{organization}/members/{user}/roles": {NoAuthorize: true}, | ||
"GET:/api/v2/organizations/{organization}/provisionerdaemons": {NoAuthorize: true}, | ||
"POST:/api/v2/organizations/{organization}/templates": {NoAuthorize: true}, | ||
|
@@ -143,11 +141,21 @@ func TestAuthorizeAllEndpoints(t *testing.T) { | |
AssertObject: rbac.ResourceWorkspace.InOrg(organization.ID).WithID(workspace.ID.String()).WithOwner(workspace.OwnerID.String()), | ||
}, | ||
"GET:/api/v2/organizations/{organization}/workspaces": {StatusCode: http.StatusOK, AssertObject: rbac.ResourceWorkspace}, | ||
"GET:/api/v2/workspaces": {StatusCode: http.StatusOK, AssertObject: rbac.ResourceWorkspace}, | ||
|
||
// These endpoints need payloads to get to the auth part. | ||
"PUT:/api/v2/users/{user}/roles": {StatusCode: http.StatusBadRequest, NoAuthorize: true}, | ||
} | ||
|
||
for k, v := range assertRoute { | ||
noTrailSlash := strings.TrimRight(k, "/") | ||
if _, ok := assertRoute[noTrailSlash]; ok && noTrailSlash != k { | ||
t.Errorf("route %q & %q is declared twice", noTrailSlash, k) | ||
t.FailNow() | ||
} | ||
assertRoute[noTrailSlash] = v | ||
} | ||
Comment on lines
+150
to
+157
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Routes were being duplicated with a trailing slash. Just catching dev errors. |
||
|
||
c, _ := srv.Config.Handler.(*chi.Mux) | ||
err = chi.Walk(c, func(method string, route string, handler http.Handler, middlewares ...func(http.Handler) http.Handler) error { | ||
name := method + ":" + route | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.