fix: Remove unused workspace routes in favor of list with filter (#2038)

* fix: Remove unused workspace routes in favor of list with filter

This consolidates the workspace routes into a single place.
It allows users to fetch a workspace by their username and
workspace name, which will be used by the frontend for routing.

* Fix RBAC

* Fix CLI usages
This commit is contained in:
Kyle Carberry
2022-06-03 14:36:08 -05:00
committed by GitHub
parent d8c440188e
commit 43f622a52d
26 changed files with 72 additions and 424 deletions
+2 -3
View File
@@ -9,7 +9,6 @@ import (
"golang.org/x/xerrors"
"github.com/google/uuid"
"github.com/kirsle/configdir"
"github.com/mattn/go-isatty"
"github.com/spf13/cobra"
@@ -180,7 +179,7 @@ func currentOrganization(cmd *cobra.Command, client *codersdk.Client) (codersdk.
// namedWorkspace fetches and returns a workspace by an identifier, which may be either
// a bare name (for a workspace owned by the current user) or a "user/workspace" combination,
// where user is either a username or UUID.
func namedWorkspace(cmd *cobra.Command, client *codersdk.Client, orgID uuid.UUID, identifier string) (codersdk.Workspace, error) {
func namedWorkspace(cmd *cobra.Command, client *codersdk.Client, identifier string) (codersdk.Workspace, error) {
parts := strings.Split(identifier, "/")
var owner, name string
@@ -195,7 +194,7 @@ func namedWorkspace(cmd *cobra.Command, client *codersdk.Client, orgID uuid.UUID
return codersdk.Workspace{}, xerrors.Errorf("invalid workspace name: %q", identifier)
}
return client.WorkspaceByOwnerAndName(cmd.Context(), orgID, owner, name)
return client.WorkspaceByOwnerAndName(cmd.Context(), owner, name)
}
// createConfig consumes the global configuration flag to produce a config root.