Skip to content

Commit

Permalink
Merge pull request #3675 from Michael9127/mike/ZTIA-355
Browse files Browse the repository at this point in the history
ZTIA-355: Adds allow_email_alias connection rule boolean to access infra policy payload
  • Loading branch information
jacobbednarz authored Nov 26, 2024
2 parents 39dc22e + 39f0a1e commit 2599d89
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .changelog/3675.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
Adds allow_email_alias connection rule boolean to access infra policy payload
```
3 changes: 2 additions & 1 deletion access_infrastructure_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ type AccessInfrastructureTargetContext struct {
}

type AccessInfrastructureConnectionRulesSSH struct {
Usernames []string `json:"usernames"`
Usernames []string `json:"usernames"`
AllowEmailAlias *bool `json:"allow_email_alias"`
}

type AccessInfrastructureConnectionRules struct {
Expand Down
12 changes: 8 additions & 4 deletions access_infrastructure_application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ var (
Require: []any{},
InfrastructureConnectionRules: &AccessInfrastructureConnectionRules{
SSH: &AccessInfrastructureConnectionRulesSSH{
Usernames: []string{"devuser"},
Usernames: []string{"devuser"},
AllowEmailAlias: BoolPtr(true),
},
},
}
Expand Down Expand Up @@ -161,7 +162,8 @@ func TestInfrastructureApplication_Create(t *testing.T) {
"require": [],
"connection_rules": {
"ssh": {
"usernames": [ "devuser" ]
"usernames": [ "devuser" ],
"allow_email_alias": true
}
},
"uid": "8dd6af47-a80b-48cb-89c1-f39299ebf096",
Expand Down Expand Up @@ -239,7 +241,8 @@ func TestInfrastructureApplication_Update(t *testing.T) {
"require": [],
"connection_rules": {
"ssh": {
"usernames": [ "devuser" ]
"usernames": [ "devuser" ],
"allow_email_alias": true
}
},
"uid": "8dd6af47-a80b-48cb-89c1-f39299ebf096",
Expand Down Expand Up @@ -317,7 +320,8 @@ func TestInfrastructureApplication_Get(t *testing.T) {
"require": [],
"connection_rules": {
"ssh": {
"usernames": [ "devuser" ]
"usernames": [ "devuser" ],
"allow_email_alias": true
}
},
"uid": "8dd6af47-a80b-48cb-89c1-f39299ebf096",
Expand Down
27 changes: 18 additions & 9 deletions access_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ var (
},
InfrastructureConnectionRules: &AccessInfrastructureConnectionRules{
SSH: &AccessInfrastructureConnectionRulesSSH{
Usernames: []string{"root", "ec2-user"},
Usernames: []string{"root", "ec2-user"},
AllowEmailAlias: BoolPtr(true),
},
},
}
Expand Down Expand Up @@ -123,7 +124,8 @@ func TestAccessPolicies(t *testing.T) {
],
"connection_rules": {
"ssh": {
"usernames": ["root", "ec2-user"]
"usernames": ["root", "ec2-user"],
"allow_email_alias": true
}
}
}
Expand Down Expand Up @@ -227,7 +229,8 @@ func TestAccessPolicy(t *testing.T) {
],
"connection_rules": {
"ssh": {
"usernames": ["root", "ec2-user"]
"usernames": ["root", "ec2-user"],
"allow_email_alias": true
}
}
}
Expand Down Expand Up @@ -325,7 +328,8 @@ func TestCreateAccessPolicy(t *testing.T) {
],
"connection_rules": {
"ssh": {
"usernames": ["root", "ec2-user"]
"usernames": ["root", "ec2-user"],
"allow_email_alias": true
}
}
}
Expand Down Expand Up @@ -367,7 +371,8 @@ func TestCreateAccessPolicy(t *testing.T) {
},
InfrastructureConnectionRules: &AccessInfrastructureConnectionRules{
SSH: &AccessInfrastructureConnectionRulesSSH{
Usernames: []string{"root", "ec2-user"},
Usernames: []string{"root", "ec2-user"},
AllowEmailAlias: BoolPtr(true),
},
},
}
Expand Down Expand Up @@ -442,7 +447,8 @@ func TestCreateAccessPolicyAuthContextRule(t *testing.T) {
},
InfrastructureConnectionRules: &AccessInfrastructureConnectionRules{
SSH: &AccessInfrastructureConnectionRulesSSH{
Usernames: []string{"root", "ec2-user"},
Usernames: []string{"root", "ec2-user"},
AllowEmailAlias: BoolPtr(true),
},
},
}
Expand Down Expand Up @@ -495,7 +501,8 @@ func TestCreateAccessPolicyAuthContextRule(t *testing.T) {
],
"connection_rules": {
"ssh": {
"usernames": ["root", "ec2-user"]
"usernames": ["root", "ec2-user"],
"allow_email_alias": true
}
}
}
Expand Down Expand Up @@ -591,7 +598,8 @@ func TestUpdateAccessPolicy(t *testing.T) {
},
InfrastructureConnectionRules: &AccessInfrastructureConnectionRules{
SSH: &AccessInfrastructureConnectionRulesSSH{
Usernames: []string{"root", "ec2-user"},
Usernames: []string{"root", "ec2-user"},
AllowEmailAlias: BoolPtr(true),
},
},
}
Expand Down Expand Up @@ -647,7 +655,8 @@ func TestUpdateAccessPolicy(t *testing.T) {
],
"connection_rules": {
"ssh": {
"usernames": ["root", "ec2-user"]
"usernames": ["root", "ec2-user"],
"allow_email_alias": true
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion turnstile.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type CreateTurnstileWidgetParams struct {
}

type UpdateTurnstileWidgetParams struct {
SiteKey string `json:"-"`
SiteKey string `json:"-"`
Name *string `json:"name,omitempty"`
Domains *[]string `json:"domains,omitempty"`
Mode *string `json:"mode,omitempty"`
Expand Down

0 comments on commit 2599d89

Please sign in to comment.