diff --git a/internal/cli/apps.go b/internal/cli/apps.go index e84abe225..e7860695a 100644 --- a/internal/cli/apps.go +++ b/internal/cli/apps.go @@ -1161,6 +1161,9 @@ func appsSessionTransferUpdateCmd(cli *cli) *cobra.Command { } } + if !appSTCanCreateToken.IsSet(cmd) { + inputs.CanCreateToken = current.SessionTransfer.GetCanCreateSessionTransferToken() + } if err := appSTCanCreateToken.AskBoolU(cmd, &inputs.CanCreateToken, current.SessionTransfer.CanCreateSessionTransferToken); err != nil { return err } @@ -1174,10 +1177,7 @@ func appsSessionTransferUpdateCmd(cli *cli) *cobra.Command { return err } - // Set the flag if it was supplied or entered by the prompt. - if appSTCanCreateToken.IsSet(cmd) || shouldPromptWhenNoLocalFlagsSet(cmd) { - st.CanCreateSessionTransferToken = &inputs.CanCreateToken - } + st.CanCreateSessionTransferToken = &inputs.CanCreateToken if len(inputs.AllowedAuthMethods) > 0 { st.AllowedAuthenticationMethods = &inputs.AllowedAuthMethods diff --git a/internal/cli/attack_protection_breached_password_detection.go b/internal/cli/attack_protection_breached_password_detection.go index 5abc346c5..b940ed6cc 100644 --- a/internal/cli/attack_protection_breached_password_detection.go +++ b/internal/cli/attack_protection_breached_password_detection.go @@ -152,6 +152,9 @@ func updateBreachedPasswordDetectionCmdRun( return err } + if !bpdFlags.Enabled.IsSet(cmd) { + inputs.Enabled = bpd.GetEnabled() + } if err := bpdFlags.Enabled.AskBoolU(cmd, &inputs.Enabled, bpd.Enabled); err != nil { return err } diff --git a/internal/cli/attack_protection_brute_force_protection.go b/internal/cli/attack_protection_brute_force_protection.go index 944ee2d90..8c77a523d 100644 --- a/internal/cli/attack_protection_brute_force_protection.go +++ b/internal/cli/attack_protection_brute_force_protection.go @@ -163,6 +163,9 @@ func updateBruteForceDetectionCmdRun( return err } + if !bfpFlags.Enabled.IsSet(cmd) { + inputs.Enabled = bfp.GetEnabled() + } if err := bfpFlags.Enabled.AskBoolU(cmd, &inputs.Enabled, bfp.Enabled); err != nil { return err } diff --git a/internal/cli/attack_protection_suspicious_ip_throttling.go b/internal/cli/attack_protection_suspicious_ip_throttling.go index 256c075b9..caec37b8f 100644 --- a/internal/cli/attack_protection_suspicious_ip_throttling.go +++ b/internal/cli/attack_protection_suspicious_ip_throttling.go @@ -186,6 +186,9 @@ func updateSuspiciousIPThrottlingCmdRun( return err } + if !sitFlags.Enabled.IsSet(cmd) { + inputs.Enabled = sit.GetEnabled() + } if err := sitFlags.Enabled.AskBoolU(cmd, &inputs.Enabled, sit.Enabled); err != nil { return err } diff --git a/internal/cli/email_provider.go b/internal/cli/email_provider.go index 702d62c75..ec0bd8c56 100644 --- a/internal/cli/email_provider.go +++ b/internal/cli/email_provider.go @@ -302,6 +302,9 @@ func updateEmailProviderCmd(cli *cli) *cobra.Command { if err := emailProviderFrom.AskU(cmd, &inputs.defaultFromAddress, currentProvider.DefaultFromAddress); err != nil { return err } + if !emailProviderEnabled.IsSet(cmd) { + inputs.enabled = currentProvider.GetEnabled() + } if err := emailProviderEnabled.AskBoolU(cmd, &inputs.enabled, currentProvider.Enabled); err != nil { return err } @@ -354,11 +357,7 @@ func updateEmailProviderCmd(cli *cli) *cobra.Command { return fmt.Errorf("unknown provider: %s", inputs.name) } } - - // Set the flag if it was supplied or entered by the prompt. - if canPrompt(cmd) || emailProviderEnabled.IsSet(cmd) { - emailProvider.Enabled = &inputs.enabled - } + emailProvider.Enabled = &inputs.enabled if len(inputs.defaultFromAddress) > 0 { emailProvider.DefaultFromAddress = &inputs.defaultFromAddress diff --git a/internal/cli/email_templates.go b/internal/cli/email_templates.go index da5ac143a..c3b5fc836 100644 --- a/internal/cli/email_templates.go +++ b/internal/cli/email_templates.go @@ -247,6 +247,9 @@ func updateEmailTemplateCmd(cli *cli) *cobra.Command { } } + if !emailTemplateEnabled.IsSet(cmd) { + inputs.Enabled = oldTemplate.GetEnabled() + } if err := emailTemplateEnabled.AskBoolU(cmd, &inputs.Enabled, oldTemplate.Enabled); err != nil { return err } diff --git a/internal/cli/log_streams_splunk.go b/internal/cli/log_streams_splunk.go index cfb239c18..6286aa3ae 100644 --- a/internal/cli/log_streams_splunk.go +++ b/internal/cli/log_streams_splunk.go @@ -228,6 +228,9 @@ func updateLogStreamsSplunkCmd(cli *cli) *cobra.Command { if err := splunkPort.AskU(cmd, &inputs.splunkPort, splunkSink.Port); err != nil { return err } + if !splunkVerifyTLS.IsSet(cmd) { + inputs.splunkVerifyTLS = splunkSink.GetSecure() + } if err := splunkVerifyTLS.AskBoolU(cmd, &inputs.splunkVerifyTLS, splunkSink.Secure); err != nil { return err } diff --git a/internal/cli/phone_provider.go b/internal/cli/phone_provider.go index 701b88c88..a44659b0a 100644 --- a/internal/cli/phone_provider.go +++ b/internal/cli/phone_provider.go @@ -312,6 +312,9 @@ func updateBrandingPhoneProviderCmd(cli *cli) *cobra.Command { return err } + if !phoneProviderDisabled.IsSet(cmd) { + inputs.disabled = existingProvider.GetDisabled() + } if err := phoneProviderDisabled.AskBoolU(cmd, &inputs.disabled, existingProvider.Disabled); err != nil { return err } @@ -342,10 +345,7 @@ func updateBrandingPhoneProviderCmd(cli *cli) *cobra.Command { } } - // Set the flag if it was supplied or entered by the prompt. - if canPrompt(cmd) || phoneProviderDisabled.IsSet(cmd) { - phoneProvider.Disabled = &inputs.disabled - } + phoneProvider.Disabled = &inputs.disabled if credentials != nil { phoneProvider.Credentials = credentials diff --git a/internal/cli/rules.go b/internal/cli/rules.go index 81e94ea90..75d8fa1a3 100644 --- a/internal/cli/rules.go +++ b/internal/cli/rules.go @@ -363,6 +363,9 @@ func updateRuleCmd(cli *cli) *cobra.Command { if err := ruleName.AskU(cmd, &inputs.Name, oldRule.Name); err != nil { return err } + if !ruleEnabled.IsSet(cmd) { + inputs.Enabled = oldRule.GetEnabled() + } if err := ruleEnabled.AskBoolU(cmd, &inputs.Enabled, oldRule.Enabled); err != nil { return err } diff --git a/test/integration/apps-test-cases.yaml b/test/integration/apps-test-cases.yaml index 50b6ad874..9447ebf7d 100644 --- a/test/integration/apps-test-cases.yaml +++ b/test/integration/apps-test-cases.yaml @@ -300,6 +300,14 @@ tests: can_create_session_transfer_token: "true" allowed_authentication_methods: "[cookie query]" enforce_device_binding: asn + + 039.1 - it successfully updates only specified value of the application session-transfer without affecting can_create_session_transfer_token boolean value: + command: auth0 apps session-transfer update $(./test/integration/scripts/get-app-id.sh) --enforce-device-binding=ip --json + exit-code: 0 + stdout: + json: + can_create_session_transfer_token: "true" + enforce_device_binding: ip 040 - it successfully renders the session-transfer of an application: command: auth0 apps session-transfer show $(./test/integration/scripts/get-app-id.sh) @@ -308,7 +316,7 @@ tests: contains: - CAN CREATE TOKEN ✓ - ALLOWED METHODS cookie, query - - DEVICE BINDING asn + - DEVICE BINDING ip 041 - given a test app, it successfully deletes the app: command: auth0 apps delete $(./test/integration/scripts/get-app-id.sh) --force diff --git a/test/integration/email-test-cases.yaml b/test/integration/email-test-cases.yaml index 41b205263..404489658 100644 --- a/test/integration/email-test-cases.yaml +++ b/test/integration/email-test-cases.yaml @@ -55,6 +55,14 @@ tests: command: auth0 email provider update --enabled --default-from-address='admin@auth0.invalid' exit-code: 0 + 011.1 - update only specified value without affecting the enabled boolean value: + command: auth0 email provider update --default-from-address='test@auth0.invalid' --json + exit-code: 0 + stdout: + json: + enabled: "true" + default_from_address: "test@auth0.invalid" + 012 - it successfully shows the email provider: command: auth0 email provider show exit-code: 0 @@ -62,13 +70,21 @@ tests: contains: - PROVIDER mandrill - ENABLED ✓ - - DEFAULT FROM ADDRESS admin@auth0.invalid + - DEFAULT FROM ADDRESS test@auth0.invalid - SETTINGS {"message":{"view_content_link":false}} 100 - it successfully updates welcome email template: command: auth0 email templates update welcome --enabled --body "