Skip to content
Open
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
8 changes: 4 additions & 4 deletions internal/cli/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 3 additions & 0 deletions internal/cli/attack_protection_brute_force_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 3 additions & 0 deletions internal/cli/attack_protection_suspicious_ip_throttling.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
9 changes: 4 additions & 5 deletions internal/cli/email_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions internal/cli/email_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 3 additions & 0 deletions internal/cli/log_streams_splunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions internal/cli/phone_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions internal/cli/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 9 additions & 1 deletion test/integration/apps-test-cases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
20 changes: 18 additions & 2 deletions test/integration/email-test-cases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,36 @@ 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
stdout:
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 "<h1>Welcome!</h1>" --from "welcome@travel0.com" --lifetime 6100 --subject "Welcome to Travel0" --url "travel0.com" --force
exit-code: 0

100.1 - it successfully updates only specified value without affecting the enabled boolean flag:
command: auth0 email templates update welcome --url "test.travel0.com" --json
exit-code: 0
stdout:
json:
enabled: "true"
resultUrl: "test.travel0.com"

101 - it successfully shows welcome email template:
command: auth0 email templates show welcome
exit-code: 0
Expand All @@ -77,7 +93,7 @@ tests:
- TEMPLATE Welcome Email
- FROM welcome@travel0.com
- SUBJECT Welcome to Travel0
- RESULT URL travel0.com
- RESULT URL test.travel0.com
- RESULT URL LIFETIME 6100
- ENABLED ✓

Expand Down
8 changes: 8 additions & 0 deletions test/integration/logs-test-cases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ tests:
sink.splunkPort: "8000"
sink.splunkSecure: "true"

022.1 - given a splunk log stream, it successfully updates only specified value without affecting secure boolean value:
command: auth0 logs streams update splunk $(cat ./test/integration/identifiers/log-stream-splunk-id) --port 8088 --json
exit-code: 0
stdout:
json:
sink.splunkSecure: "true"
sink.splunkPort: "8088"

023 - given a splunk log stream, it successfully deletes the log stream:
command: auth0 logs streams delete $(cat ./test/integration/identifiers/log-stream-splunk-id) --force --no-input
exit-code: 0
Expand Down
10 changes: 9 additions & 1 deletion test/integration/phone-test-cases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,20 @@ tests:
command: auth0 phone provider update $(./test/integration/scripts/get-custom-phone-provider-id.sh) --provider=custom --disabled --configuration '{ "delivery_methods":["text", "voice"] }'
exit-code: 0

010.1 - update only the specified value without affecting the disabled boolean flag:
command: auth0 phone provider update $(./test/integration/scripts/get-custom-phone-provider-id.sh) --provider=twilio --json
exit-code: 0
stdout:
json:
disabled: "true"
name: "twilio"

011 - it successfully shows the phone provider:
command: auth0 phone provider show $(./test/integration/scripts/get-custom-phone-provider-id.sh)
exit-code: 0
stdout:
contains:
- PROVIDER custom
- PROVIDER twilio
- DISABLED ✓
- CONFIGURATION {"delivery_methods":["text","voice"]}

Expand Down
Loading