Skip to content

Commit

Permalink
fix: Accept role ID instead of Key for organization settings creator …
Browse files Browse the repository at this point in the history
…role

We update the logic of the instance organization settings method in order
to accept a role ID instead of a Key for the default creator role. This is
because we should use an immutable identifier instead of the Key which
customers are able to modify
  • Loading branch information
chanioxaris committed Nov 14, 2023
1 parent 92fa766 commit e5a038e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion clerk/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +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"`
CreatorRoleID *string `json:"creator_role_id,omitempty"`
}

func (s *InstanceService) UpdateOrganizationSettings(params UpdateOrganizationSettingsParams) (*OrganizationSettingsResponse, error) {
Expand Down
5 changes: 2 additions & 3 deletions clerk/instances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,9 @@ func TestInstanceService_UpdateOrganizationSettings_happyPath(t *testing.T) {
})

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

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

0 comments on commit e5a038e

Please sign in to comment.