diff --git a/internal/scim_test.go b/internal/scim_test.go index 61355b476..a319184d0 100644 --- a/internal/scim_test.go +++ b/internal/scim_test.go @@ -27,7 +27,7 @@ func TestAccCurrentUser(t *testing.T) { assert.NotEmpty(t, me.UserName) } -func TestAccUsers(t *testing.T) { +func TestAccWorkspaceUsers(t *testing.T) { ctx, w := workspaceTest(t) // create new user @@ -71,6 +71,39 @@ func TestAccUsers(t *testing.T) { assert.True(t, apierr.IsMissing(err)) } +func TestAccAccountUsers(t *testing.T) { + ctx, a := accountTest(t) + + user, err := a.Users.Create(ctx, iam.User{ + DisplayName: RandomName("Me "), + UserName: RandomEmail(), + }) + require.NoError(t, err) + t.Cleanup(func() { + err := a.Users.DeleteById(ctx, user.Id) + require.True(t, err == nil || apierr.IsMissing(err)) + }) + + assert.Equal(t, 0, len(user.Roles)) + err = a.Users.Patch(ctx, iam.PartialUpdate{ + Id: user.Id, + Schema: []iam.PatchSchema{iam.PatchSchemaUrnIetfParamsScimApiMessages20PatchOp}, + Operations: []iam.Patch{ + {Op: iam.PatchOpAdd, Value: iam.User{ + Roles: []iam.ComplexValue{ + {Value: "account_admin"}, + }, + }}, + }, + }) + require.NoError(t, err) + + byId, err := a.Users.GetById(ctx, user.Id) + require.NoError(t, err) + assert.Equal(t, user.Id, byId.Id) + assert.Equal(t, 1, len(byId.Roles)) +} + func TestAccGroups(t *testing.T) { ctx, w := workspaceTest(t) diff --git a/openapi/roll/optimize.go b/openapi/roll/optimize.go index 931cdcf9d..64083519d 100644 --- a/openapi/roll/optimize.go +++ b/openapi/roll/optimize.go @@ -84,7 +84,7 @@ func (s *suiteOptimizer) enumConstant(l *lookup) expression { Name: prefix, }, Named: code.Named{ - Name: value, + Name: e.Content, }, Content: e.Content, } diff --git a/service/iam/model.go b/service/iam/model.go index 4fc19f476..ee447fa17 100755 --- a/service/iam/model.go +++ b/service/iam/model.go @@ -188,7 +188,7 @@ type Group struct { Groups []ComplexValue `json:"groups,omitempty"` // Databricks group ID - Id string `json:"id,omitempty" url:"-"` + Id string `json:"id,omitempty"` Members []ComplexValue `json:"members,omitempty"` // Container for the group identifier. Workspace local versus account.