Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfd8844b

Browse files
committed
fix: only return non-deleted groups
1 parent539bea7 commitfd8844b

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

‎coderd/workspaces.go‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,12 +2215,18 @@ func (api *API) workspaceACL(rw http.ResponseWriter, r *http.Request) {
22152215
}
22162216
groupIDs=append(groupIDs,id)
22172217
}
2218-
// For context see https://github.com/coder/coder/pull/19375
2219-
// nolint:gocritic
2220-
dbGroups,err:=api.Database.GetGroups(dbauthz.AsSystemRestricted(ctx), database.GetGroupsParams{GroupIds:groupIDs})
2221-
iferr!=nil&&!xerrors.Is(err,sql.ErrNoRows) {
2222-
httpapi.InternalServerError(rw,err)
2223-
return
2218+
2219+
// `GetGroups` returns all groups in the org if `GroupIds` is empty so we check
2220+
// the length before making the DB call.
2221+
dbGroups:=make([]database.GetGroupsRow,0)
2222+
iflen(groupIDs)>0 {
2223+
// For context see https://github.com/coder/coder/pull/19375
2224+
// nolint:gocritic
2225+
dbGroups,err=api.Database.GetGroups(dbauthz.AsSystemRestricted(ctx), database.GetGroupsParams{GroupIds:groupIDs})
2226+
iferr!=nil&&!xerrors.Is(err,sql.ErrNoRows) {
2227+
httpapi.InternalServerError(rw,err)
2228+
return
2229+
}
22242230
}
22252231

22262232
groups:=make([]codersdk.WorkspaceGroup,0,len(dbGroups))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp