feat: add sharing remove command to the CLI (#19767)

Closes
[coder/internal#861](https://github.com/coder/internal/issues/861)
This commit is contained in:
Brett Kolodny
2025-09-11 16:22:25 -04:00
committed by GitHub
parent d5a02d570f
commit 8d5c566a98
4 changed files with 509 additions and 106 deletions
+12 -6
View File
@@ -2215,12 +2215,18 @@ func (api *API) workspaceACL(rw http.ResponseWriter, r *http.Request) {
}
groupIDs = append(groupIDs, id)
}
// For context see https://github.com/coder/coder/pull/19375
// nolint:gocritic
dbGroups, err := api.Database.GetGroups(dbauthz.AsSystemRestricted(ctx), database.GetGroupsParams{GroupIds: groupIDs})
if err != nil && !xerrors.Is(err, sql.ErrNoRows) {
httpapi.InternalServerError(rw, err)
return
// `GetGroups` returns all groups if `GroupIds` is empty so we check the length
// before making the DB call.
dbGroups := make([]database.GetGroupsRow, 0)
if len(groupIDs) > 0 {
// For context see https://github.com/coder/coder/pull/19375
// nolint:gocritic
dbGroups, err = api.Database.GetGroups(dbauthz.AsSystemRestricted(ctx), database.GetGroupsParams{GroupIds: groupIDs})
if err != nil && !xerrors.Is(err, sql.ErrNoRows) {
httpapi.InternalServerError(rw, err)
return
}
}
groups := make([]codersdk.WorkspaceGroup, 0, len(dbGroups))