fix: adjust guest access settings (#53)

This commit is contained in:
Mateusz Filipowicz
2025-03-17 04:09:53 +01:00
committed by GitHub
parent 873818ddac
commit c8a3b96575
3 changed files with 16 additions and 4 deletions

View File

@@ -482,9 +482,17 @@ customizations:
omitEmpty: true omitEmpty: true
SettingGuestAccess: SettingGuestAccess:
fields: fields:
AllowedSubnet:
jsonPath: "allowed_subnet"
RestrictedSubnet:
jsonPath: "restricted_subnet"
GoogleDomain:
omitEmpty: false
Expire: Expire:
fieldType: "int" fieldType: "int"
customUnmarshalType: "emptyStringInt" customUnmarshalType: "emptyStringInt"
RestrictedDNSServers:
omitEmpty: false
SettingIps: SettingIps:
fields: fields:
Honeypot: Honeypot:

View File

@@ -47,6 +47,7 @@ type FieldInfoOverride struct {
OmitEmpty *bool `yaml:"omitEmpty"` OmitEmpty *bool `yaml:"omitEmpty"`
CustomUnmarshalType *string `yaml:"customUnmarshalType"` CustomUnmarshalType *string `yaml:"customUnmarshalType"`
CustomUnmarshalFunc *string `yaml:"customUnmarshalFunc"` CustomUnmarshalFunc *string `yaml:"customUnmarshalFunc"`
JsonPath *string `yaml:"jsonPath"`
} }
func compositeCustomizationsProcessor(customizationsProcessor FieldProcessor) FieldProcessor { func compositeCustomizationsProcessor(customizationsProcessor FieldProcessor) FieldProcessor {
@@ -103,6 +104,9 @@ func (r *ResourceCustomization) toFieldProcessor() FieldProcessor {
if fc.Overrides.FieldName != nil { if fc.Overrides.FieldName != nil {
f.FieldName = *fc.Overrides.FieldName f.FieldName = *fc.Overrides.FieldName
} }
if fc.Overrides.JsonPath != nil {
f.JSONName = *fc.Overrides.JsonPath
}
} }
return nil return nil
} }

View File

@@ -29,7 +29,7 @@ type SettingGuestAccess struct {
Key string `json:"key"` Key string `json:"key"`
AllowedSubnet string `json:"allowed_subnet_,omitempty"` AllowedSubnet string `json:"allowed_subnet,omitempty"`
Auth string `json:"auth,omitempty" validate:"omitempty,oneof=none hotspot facebook_wifi custom"` // none|hotspot|facebook_wifi|custom Auth string `json:"auth,omitempty" validate:"omitempty,oneof=none hotspot facebook_wifi custom"` // none|hotspot|facebook_wifi|custom
AuthUrl string `json:"auth_url,omitempty"` AuthUrl string `json:"auth_url,omitempty"`
AuthorizeUseSandbox bool `json:"authorize_use_sandbox"` AuthorizeUseSandbox bool `json:"authorize_use_sandbox"`
@@ -46,7 +46,7 @@ type SettingGuestAccess struct {
FacebookWifiGwName string `json:"facebook_wifi_gw_name,omitempty"` FacebookWifiGwName string `json:"facebook_wifi_gw_name,omitempty"`
Gateway string `json:"gateway,omitempty" validate:"omitempty,oneof=paypal stripe authorize quickpay merchantwarrior ippay"` // paypal|stripe|authorize|quickpay|merchantwarrior|ippay Gateway string `json:"gateway,omitempty" validate:"omitempty,oneof=paypal stripe authorize quickpay merchantwarrior ippay"` // paypal|stripe|authorize|quickpay|merchantwarrior|ippay
GoogleClientID string `json:"google_client_id"` GoogleClientID string `json:"google_client_id"`
GoogleDomain string `json:"google_domain,omitempty"` GoogleDomain string `json:"google_domain"`
GoogleEnabled bool `json:"google_enabled"` GoogleEnabled bool `json:"google_enabled"`
GoogleScopeEmail bool `json:"google_scope_email"` GoogleScopeEmail bool `json:"google_scope_email"`
IPpayUseSandbox bool `json:"ippay_use_sandbox"` IPpayUseSandbox bool `json:"ippay_use_sandbox"`
@@ -99,8 +99,8 @@ type SettingGuestAccess struct {
RedirectToHttps bool `json:"redirect_to_https"` RedirectToHttps bool `json:"redirect_to_https"`
RedirectUrl string `json:"redirect_url,omitempty"` RedirectUrl string `json:"redirect_url,omitempty"`
RestrictedDNSEnabled bool `json:"restricted_dns_enabled"` RestrictedDNSEnabled bool `json:"restricted_dns_enabled"`
RestrictedDNSServers []string `json:"restricted_dns_servers,omitempty" validate:"omitempty,ipv4"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$ RestrictedDNSServers []string `json:"restricted_dns_servers" validate:"omitempty,ipv4"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
RestrictedSubnet string `json:"restricted_subnet_,omitempty"` RestrictedSubnet string `json:"restricted_subnet,omitempty"`
TemplateEngine string `json:"template_engine,omitempty" validate:"omitempty,oneof=jsp angular"` // jsp|angular TemplateEngine string `json:"template_engine,omitempty" validate:"omitempty,oneof=jsp angular"` // jsp|angular
VoucherCustomized bool `json:"voucher_customized"` VoucherCustomized bool `json:"voucher_customized"`
VoucherEnabled bool `json:"voucher_enabled"` VoucherEnabled bool `json:"voucher_enabled"`