Skip to content

Commit eba573f

Browse files
committed
feat(perms): migrate owner-based to workspace
1 parent 7a1e912 commit eba573f

50 files changed

Lines changed: 985 additions & 1304 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/root.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func NewDryccCommand() *cobra.Command {
5454
rootCmd.AddCommand(parser.NewKeysCommand(&cmdr))
5555
rootCmd.AddCommand(parser.NewLabelsCommand(&cmdr))
5656
rootCmd.AddCommand(parser.NewLimitsCommand(&cmdr))
57-
rootCmd.AddCommand(parser.NewPermsCommand(&cmdr))
57+
rootCmd.AddCommand(parser.NewWorkspacesCommand(&cmdr))
5858
rootCmd.AddCommand(parser.NewPsCommand(&cmdr))
5959
rootCmd.AddCommand(parser.NewPtsCommand(&cmdr))
6060
rootCmd.AddCommand(parser.NewRegistryCommand(&cmdr))
@@ -68,7 +68,6 @@ func NewDryccCommand() *cobra.Command {
6868
rootCmd.AddCommand(parser.NewTLSCommand(&cmdr))
6969
rootCmd.AddCommand(parser.NewTokensCommand(&cmdr))
7070
rootCmd.AddCommand(parser.NewUpdateCommand(&cmdr))
71-
rootCmd.AddCommand(parser.NewUsersCommand(&cmdr))
7271
rootCmd.AddCommand(parser.NewVolumesCommand(&cmdr))
7372
rootCmd.AddCommand(parser.NewVersionCommand(&cmdr))
7473
// shortcuts

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.25
55
require (
66
github.com/chai2010/gettext-go v1.0.3
77
github.com/containerd/console v1.0.4
8-
github.com/drycc/controller-sdk-go v0.0.0-20251211045545-b196e6964a1c
8+
github.com/drycc/controller-sdk-go v0.0.0-20260324023744-f5a3de0a532e
99
github.com/drycc/pkg v0.0.0-20250917064731-345368da3dbf
1010
github.com/minio/selfupdate v0.6.0
1111
github.com/olekukonko/tablewriter v0.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6N
99
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
1010
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
1111
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
12-
github.com/drycc/controller-sdk-go v0.0.0-20251211045545-b196e6964a1c h1:v7dQdercvt0o+/dOeCpQSEYedvo2lTY8eCwHBxx48hg=
13-
github.com/drycc/controller-sdk-go v0.0.0-20251211045545-b196e6964a1c/go.mod h1:eHcmYwg81ASlP55/U587xnBZnZoeZnPHXGeQ8nYWnsg=
12+
github.com/drycc/controller-sdk-go v0.0.0-20260324023744-f5a3de0a532e h1:4GH098Zz4VsTvk8KfLHQQTP5f/O41i7dk+h/GOYiDy8=
13+
github.com/drycc/controller-sdk-go v0.0.0-20260324023744-f5a3de0a532e/go.mod h1:eHcmYwg81ASlP55/U587xnBZnZoeZnPHXGeQ8nYWnsg=
1414
github.com/drycc/pkg v0.0.0-20250917064731-345368da3dbf h1:CYy3NoPhfFhkGAbEppTOQfY/HC2s0FJDcBgbtRKeweg=
1515
github.com/drycc/pkg v0.0.0-20250917064731-345368da3dbf/go.mod h1:BrrNrNskHKm+nJYhXfGuI114w8nupi0AMo8QZHID7CM=
1616
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=

internal/commands/apps.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ import (
1818
)
1919

2020
// AppCreate creates an app.
21-
func (d *DryccCmd) AppCreate(id, remote string, noRemote bool) error {
21+
func (d *DryccCmd) AppCreate(id, workspace, remote string, noRemote bool) error {
2222
s, err := settings.Load(d.ConfigFile)
2323
if err != nil {
2424
return err
2525
}
2626

2727
d.Print("Creating Application... ")
2828
quit := progress(d.WOut)
29-
app, err := apps.New(s.Client, id)
29+
app, err := apps.New(s.Client, id, workspace)
3030

3131
quit <- true
3232
<-quit
@@ -73,11 +73,11 @@ func (d *DryccCmd) AppsList(results int) error {
7373
return err
7474
}
7575
if count > 0 {
76-
table := d.getDefaultFormatTable([]string{"ID", "OWNER", "CREATED", "UPDATED"})
76+
table := d.getDefaultFormatTable([]string{"ID", "WORKSPACE", "CREATED", "UPDATED"})
7777
for _, app := range apps {
7878
table.Append([]string{
7979
app.ID,
80-
app.Owner,
80+
app.Workspace,
8181
d.formatTime(app.Created),
8282
d.formatTime(app.Updated),
8383
})
@@ -110,7 +110,7 @@ func (d *DryccCmd) AppInfo(appID string) error {
110110
table.Append([]string{"App:", app.ID})
111111
table.Append([]string{"URL:", url})
112112
table.Append([]string{"UUID:", app.UUID})
113-
table.Append([]string{"Owner:", app.Owner})
113+
table.Append([]string{"Workspace:", app.Workspace})
114114
table.Append([]string{"Created:", d.formatTime(app.Created)})
115115
table.Append([]string{"Updated:", d.formatTime(app.Updated)})
116116

@@ -279,16 +279,16 @@ func (d *DryccCmd) AppDestroy(appID, confirm string) error {
279279
return nil
280280
}
281281

282-
// AppTransfer transfers app ownership to another user.
283-
func (d *DryccCmd) AppTransfer(appID, username string) error {
282+
// AppTransfer transfers app to another workspace.
283+
func (d *DryccCmd) AppTransfer(appID, workspace string) error {
284284
appID, s, err := loader.LoadAppSettings(d.ConfigFile, appID)
285285
if err != nil {
286286
return err
287287
}
288288

289-
d.Printf("Transferring %s to %s... ", appID, username)
289+
d.Printf("Transferring %s to %s... ", appID, workspace)
290290

291-
err = apps.Transfer(s.Client, appID, username)
291+
err = apps.Transfer(s.Client, appID, workspace)
292292
if d.checkAPICompatibility(s.Client, err) != nil {
293293
return err
294294
}

internal/commands/apps_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestAppsList(t *testing.T) {
3838
{
3939
"uuid": "c4aed81c-d1ca-4ff1-ab89-d2151264e1a3",
4040
"id": "lorem-ipsum",
41-
"owner": "dolar-sit-amet",
41+
"workspace": "dolar-sit-amet",
4242
"created": "2016-08-22T17:40:16Z",
4343
"updated": "2016-08-22T17:40:16Z",
4444
"structure": {
@@ -48,7 +48,7 @@ func TestAppsList(t *testing.T) {
4848
{
4949
"uuid": "c4aed81c-d1ca-4ff1-ab89-d2151264e1a3",
5050
"id": "consectetur",
51-
"owner": "adipiscing",
51+
"workspace": "adipiscing",
5252
"created": "2016-08-22T17:40:16Z",
5353
"updated": "2016-08-22T17:40:16Z",
5454
"structure": {
@@ -61,7 +61,7 @@ func TestAppsList(t *testing.T) {
6161

6262
err = cmdr.AppsList(-1)
6363
assert.NoError(t, err)
64-
testutil.AssertOutput(t, b.String(), `ID OWNER CREATED UPDATED
64+
testutil.AssertOutput(t, b.String(), `ID WORKSPACE CREATED UPDATED
6565
lorem-ipsum dolar-sit-amet 2016-08-22T17:40:16Z 2016-08-22T17:40:16Z
6666
consectetur adipiscing 2016-08-22T17:40:16Z 2016-08-22T17:40:16Z
6767
`)
@@ -87,7 +87,7 @@ func TestAppsListLimit(t *testing.T) {
8787
{
8888
"uuid": "c4aed81c-d1ca-4ff1-ab89-d2151264e1a3",
8989
"id": "lorem-ipsum",
90-
"owner": "dolar-sit-amet",
90+
"workspace": "dolar-sit-amet",
9191
"created": "2016-08-22T17:40:16Z",
9292
"updated": "2016-08-22T17:40:16Z",
9393
"structure": {
@@ -100,7 +100,7 @@ func TestAppsListLimit(t *testing.T) {
100100

101101
err = cmdr.AppsList(1)
102102
assert.NoError(t, err)
103-
testutil.AssertOutput(t, b.String(), `ID OWNER CREATED UPDATED
103+
testutil.AssertOutput(t, b.String(), `ID WORKSPACE CREATED UPDATED
104104
lorem-ipsum dolar-sit-amet 2016-08-22T17:40:16Z 2016-08-22T17:40:16Z
105105
`)
106106
}
@@ -120,7 +120,7 @@ func TestAppsInfo(t *testing.T) {
120120
fmt.Fprintf(w, `{
121121
"uuid": "c4aed81c-d1ca-4ff1-ab89-d2151264e1a3",
122122
"id": "lorem-ipsum",
123-
"owner": "dolar-sit-amet",
123+
"workspace": "dolar-sit-amet",
124124
"structure": {
125125
"cmd": 1
126126
},
@@ -189,7 +189,7 @@ func TestAppsInfo(t *testing.T) {
189189
testutil.AssertOutput(t, b.String(), `App: lorem-ipsum
190190
URL: `+url+`
191191
UUID: c4aed81c-d1ca-4ff1-ab89-d2151264e1a3
192-
Owner: dolar-sit-amet
192+
Workspace: dolar-sit-amet
193193
Created: 2016-08-22T17:40:16Z
194194
Updated: 2016-08-22T17:40:16Z
195195
Processes:
@@ -223,7 +223,7 @@ func TestAppDestroy(t *testing.T) {
223223
fmt.Fprintf(w, `{
224224
"uuid": "c4aed81c-d1ca-4ff1-ab89-d2151264e1a3",
225225
"id": "lorem-ipsum",
226-
"owner": "dolar-sit-amet",
226+
"workspace": "dolar-sit-amet",
227227
"structure": {
228228
"cmd": 1
229229
},
@@ -256,7 +256,7 @@ func TestAppTransfer(t *testing.T) {
256256
fmt.Fprintf(w, `{
257257
"uuid": "c4aed81c-d1ca-4ff1-ab89-d2151264e1a3",
258258
"id": "lorem-ipsum",
259-
"owner": "dolar-sit-amet",
259+
"workspace": "dolar-sit-amet",
260260
"structure": {
261261
"cmd": 1
262262
},
@@ -324,11 +324,11 @@ func TestRemoteExists(t *testing.T) {
324324
var b bytes.Buffer
325325
cmdr := DryccCmd{WOut: &b, ConfigFile: cf}
326326

327-
err = cmdr.AppCreate("foo", "drycc", false)
327+
err = cmdr.AppCreate("foo", "", "drycc", false)
328328

329329
// Check that an error occurred and it contains the remote name
330330
// This works for any language since the remote name "drycc" is always in the error
331331
assert.Error(t, err)
332-
assert.Contains(t, err.Error(), "drycc",
332+
assert.Contains(t, err.Error(), "drycc",
333333
"error message should contain the remote name 'drycc', got: %s", err.Error())
334334
}

internal/commands/builds.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ func (d *DryccCmd) BuildsInfo(appID string, version int) error {
2727
table.Append([]string{"App:", build.App})
2828
table.Append([]string{"Sha:", build.Sha})
2929
table.Append([]string{"UUID:", build.UUID})
30-
table.Append([]string{"Owner:", build.Owner})
3130
table.Append([]string{"Image:", build.Image})
3231
table.Append([]string{"Stack:", build.Stack})
3332
table.Append([]string{"Created:", build.Created})

internal/commands/builds_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ func TestBuildsInfo(t *testing.T) {
6161
testutil.AssertOutput(t, b.String(), `App:
6262
Sha:
6363
UUID: de1bf5b5-4a72-4f94-a10c-d2a3741cdf75
64-
Owner:
6564
Image:
6665
Stack:
6766
Created: 2014-01-01T00:00:00UTC

internal/commands/certs.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ func (d *DryccCmd) CertInfo(appID string, name string) error {
132132
table.Append([]string{"Subject:", safeGetString(cert.Subject)})
133133
table.Append([]string{""})
134134
table.Append([]string{"Connected Domains:", safeGetString(strings.Join(cert.Domains[:], ","))})
135-
table.Append([]string{"Owner:", safeGetString(cert.Owner)})
136135
table.Append([]string{"Created:", d.formatTime(cert.Created)})
137136
table.Append([]string{"Updated:", d.formatTime(cert.Updated)})
138137
table.Render()

internal/commands/certs_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ Issuer: testca
200200
Subject: testing
201201
202202
Connected Domains: test.com,example.com
203-
Owner: admin
204203
Created: 2016-06-09T00:00:00Z
205204
Updated: 2016-06-09T00:00:00Z
206205
`, "output")
@@ -225,7 +224,6 @@ Issuer: <none>
225224
Subject: <none>
226225
227226
Connected Domains: <none>
228-
Owner: <none>
229227
Created:
230228
Updated:
231229
`, "output")

internal/commands/commands.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
//
1414
//go:generate mockgen -package testmocks -destination testmocks/mock_pack_client.go github.com/buildpacks/pack/internal/commands PackClient
1515
type Commander interface {
16-
AppCreate(string, string, bool) error
16+
AppCreate(string, string, string, bool) error
1717
AppsList(int) error
1818
AppInfo(string) error
1919
AppOpen(string) error
@@ -87,10 +87,13 @@ type Commander interface {
8787
TimeoutsList(string, int) error
8888
TimeoutsSet(string, []string) error
8989
TimeoutsUnset(string, []string) error
90-
PermList(string, int) error
91-
PermCreate(string, string, string) error
92-
PermUpdate(string, string, string) error
93-
PermDelete(string, string) error
90+
WorkspacesList(int) error
91+
WorkspacesCreate(string, string) error
92+
WorkspacesInfo(string, int) error
93+
WorkspacesDelete(string, string) error
94+
WorkspacesInvite(string, string) error
95+
WorkspacesRemove(string, string) error
96+
WorkspacesUpdate(string, string, string, *bool) error
9497
PsList(string, int) error
9598
PsLogs(string, string, int, bool, string, bool) error
9699
PsExec(string, string, bool, bool, []string) error
@@ -122,9 +125,6 @@ type Commander interface {
122125
TLSAutoDisable(string) error
123126
TLSAutoIssuer(string, string, string, string, string) error
124127
Update(bool) error
125-
UsersList(int) error
126-
UsersEnable(string) error
127-
UsersDisable(string) error
128128
Println(...any) (int, error)
129129
Print(...any) (int, error)
130130
Printf(string, ...any) (int, error)

0 commit comments

Comments
 (0)