Skip to content

Commit

Permalink
Add UI read-only field (Terraform/API only mode) to Access org
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin-Holmes committed Oct 11, 2022
1 parent 0d4bd58 commit 905d8f9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .changelog/1104.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
access: add UI read-only field to organizations
```
11 changes: 6 additions & 5 deletions access_organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import (

// AccessOrganization represents an Access organization.
type AccessOrganization struct {
CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
Name string `json:"name"`
AuthDomain string `json:"auth_domain"`
LoginDesign AccessOrganizationLoginDesign `json:"login_design"`
CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
Name string `json:"name"`
AuthDomain string `json:"auth_domain"`
LoginDesign AccessOrganizationLoginDesign `json:"login_design"`
IsUIReadOnly *bool `json:"is_ui_read_only,omitempty"`
}

// AccessOrganizationLoginDesign represents the login design options.
Expand Down
8 changes: 7 additions & 1 deletion access_organization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestAccessOrganization(t *testing.T) {
"updated_at": "2014-01-01T05:20:00.12345Z",
"name": "Widget Corps Internal Applications",
"auth_domain": "test.cloudflareaccess.com",
"is_ui_read_only": false,
"login_design": {
"background_color": "#c5ed1b",
"logo_path": "https://example.com/logo.png",
Expand Down Expand Up @@ -53,6 +54,7 @@ func TestAccessOrganization(t *testing.T) {
HeaderText: "Widget Corp",
FooterText: "© Widget Corp",
},
IsUIReadOnly: BoolPtr(false),
}

mux.HandleFunc("/accounts/"+testAccountID+"/access/organizations", handler)
Expand Down Expand Up @@ -88,6 +90,7 @@ func TestCreateAccessOrganization(t *testing.T) {
"updated_at": "2014-01-01T05:20:00.12345Z",
"name": "Widget Corps Internal Applications",
"auth_domain": "test.cloudflareaccess.com",
"is_ui_read_only": true,
"login_design": {
"background_color": "#c5ed1b",
"logo_path": "https://example.com/logo.png",
Expand Down Expand Up @@ -115,6 +118,7 @@ func TestCreateAccessOrganization(t *testing.T) {
HeaderText: "Widget Corp",
FooterText: "© Widget Corp",
},
IsUIReadOnly: BoolPtr(true),
}

mux.HandleFunc("/accounts/"+testAccountID+"/access/organizations", handler)
Expand Down Expand Up @@ -156,7 +160,8 @@ func TestUpdateAccessOrganization(t *testing.T) {
"text_color": "#c5ed1b",
"header_text": "Widget Corp",
"footer_text": "© Widget Corp"
}
},
"is_ui_read_only": false
}
}
`)
Expand All @@ -177,6 +182,7 @@ func TestUpdateAccessOrganization(t *testing.T) {
HeaderText: "Widget Corp",
FooterText: "© Widget Corp",
},
IsUIReadOnly: BoolPtr(false),
}

mux.HandleFunc("/accounts/"+testAccountID+"/access/organizations", handler)
Expand Down

0 comments on commit 905d8f9

Please sign in to comment.