Skip to content

Commit

Permalink
feat: Support updating the default org creator role
Browse files Browse the repository at this point in the history
  • Loading branch information
mzhong9723 committed Nov 8, 2023
1 parent bf08cdc commit 63fe9cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions clerk/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type OrganizationSettingsResponse struct {
AdminDeleteEnabled bool `json:"admin_delete_enabled"`
DomainsEnabled bool `json:"domains_enabled"`
DomainsEnrollmentModes []string `json:"domains_enrollment_modes"`
CreatorRole string `json:"creator_role"`
}

type UpdateOrganizationSettingsParams struct {
Expand All @@ -99,6 +100,7 @@ type UpdateOrganizationSettingsParams struct {
AdminDeleteEnabled *bool `json:"admin_delete_enabled,omitempty"`
DomainsEnabled *bool `json:"domains_enabled,omitempty"`
DomainsEnrollmentModes []string `json:"domains_enrollment_modes,omitempty"`
CreatorRole string `json:"creator_role,omitempty"`
}

func (s *InstanceService) UpdateOrganizationSettings(params UpdateOrganizationSettingsParams) (*OrganizationSettingsResponse, error) {
Expand Down
7 changes: 5 additions & 2 deletions clerk/instances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ func TestInstanceService_UpdateOrganizationSettings_happyPath(t *testing.T) {
"manual_invitation",
"automatic_invitation",
"automatic_suggestion"
]
],
"creator_role": "org:custom_admin"
}`
var organizationSettingsResponse OrganizationSettingsResponse
_ = json.Unmarshal([]byte(dummyOrganizationSettingsResponseJSON), &organizationSettingsResponse)
Expand All @@ -125,8 +126,10 @@ func TestInstanceService_UpdateOrganizationSettings_happyPath(t *testing.T) {
})

enabled := true
defaultCreatorRole := "org:custom_admin"
got, _ := client.Instances().UpdateOrganizationSettings(UpdateOrganizationSettingsParams{
Enabled: &enabled,
Enabled: &enabled,
CreatorRole: defaultCreatorRole,
})

assert.Equal(t, &organizationSettingsResponse, got)
Expand Down

0 comments on commit 63fe9cd

Please sign in to comment.