MCPcopy Create free account
hub / github.com/auth0/auth0-cli / deleteUserBlocksCmd

Function deleteUserBlocksCmd

internal/cli/users_blocks.go:79–118  ·  view source on GitHub ↗
(cli *cli)

Source from the content-addressed store, hash-verified

77}
78
79func deleteUserBlocksCmd(cli *cli) *cobra.Command {
80 cmd := &cobra.Command{
81 Use: "unblock",
82 Short: "Remove brute-force protection blocks for users",
83 Long: "Remove brute-force protection blocks for users by user ID, username, phone number or email.",
84 Example: ` auth0 users blocks unblock <user-id1|username1|email1|phone-number1> <user-id2|username2|email2|phone-number2>
85 auth0 users blocks unblock "auth0|61b5b6e90783fa19f7c57dad"
86 auth0 users blocks unblock "frederik@travel0.com" "poovam@travel0.com"
87 `,
88 RunE: func(cmd *cobra.Command, args []string) error {
89 var ids []string
90 if len(args) == 0 {
91 var id string
92 if err := userIdentifier.Ask(cmd, &id); err != nil {
93 return err
94 }
95 ids = append(ids, id)
96 } else {
97 ids = args
98 }
99
100 return ansi.ProgressBar("Unblocking user(s)", ids, func(_ int, id string) error {
101 if id != "" {
102 err := cli.api.User.Unblock(cmd.Context(), id)
103 if mErr, ok := err.(management.Error); ok && mErr.Status() != http.StatusBadRequest {
104 return fmt.Errorf("failed to unblock user with identifier %s: %w", id, err)
105 }
106
107 err = cli.api.User.UnblockByIdentifier(cmd.Context(), id)
108 if err != nil {
109 return fmt.Errorf("failed to unblock user with identifier %s: %w", id, err)
110 }
111 }
112 return nil
113 })
114 },
115 }
116
117 return cmd
118}

Callers 1

userBlocksCmdFunction · 0.85

Calls 6

ProgressBarFunction · 0.92
ErrorfMethod · 0.80
UnblockMethod · 0.65
UnblockByIdentifierMethod · 0.65
AskMethod · 0.45
StatusMethod · 0.45

Tested by

no test coverage detected