Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update organization creator role #174

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading