Skip to content

Commit

Permalink
Merge branch 'update-changelog-1.0.0' of https://github.com/auth0/aut…
Browse files Browse the repository at this point in the history
…h0-cli into update-changelog-1.0.0
  • Loading branch information
willvedd committed Apr 14, 2023
2 parents 53869bc + 09d632c commit 3aa6bad
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 52 deletions.
19 changes: 14 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.0.0](https://github.com/auth0/auth0-cli/tree/1.0.0) (Apr 14, 2023)
## [v1.0.0](https://github.com/auth0/auth0-cli/tree/v1.0.0) (Apr 14, 2023)

Refer to the [v1 migration guide](MIGRATION_GUIDE.md) for instructions on how to navigate breaking changes.
[Full Changelog](https://github.com/auth0/auth0-cli/compare/v0.13.1...v1.0.0)

:warning: Refer to the [v1 migration guide](MIGRATION_GUIDE.md) for instructions on how to navigate breaking changes.

### Added

Expand Down Expand Up @@ -80,7 +82,9 @@ Refer to the [v1 migration guide](MIGRATION_GUIDE.md) for instructions on how to
- Updating of action triggers which inevitably results in error [#597]
- `-u` shortform alias for `--upsert` flag in `auth0 users import` [#735]

## [1.0.0-beta.3](https://github.com/auth0/auth0-cli/tree/1.0.0-beta.3) (Mar 30, 2023)
## [v1.0.0-beta.3](https://github.com/auth0/auth0-cli/tree/v1.0.0-beta.3) (Mar 30, 2023)

[Full Changelog](https://github.com/auth0/auth0-cli/compare/v1.0.0-beta.2...v1.0.0-beta.3)

### Added

Expand All @@ -98,7 +102,9 @@ Refer to the [v1 migration guide](MIGRATION_GUIDE.md) for instructions on how to
- Possible panic when running `auth0 ul update` with empty branding settings (ex: newly-created tenant) [#692]
- Inability to update user password with `auth0 users update --password` [#686]

## [1.0.0-beta.2](https://github.com/auth0/auth0-cli/tree/1.0.0-beta.2) (Feb 14, 2023)
## [v1.0.0-beta.2](https://github.com/auth0/auth0-cli/tree/v1.0.0-beta.2) (Feb 14, 2023)

[Full Changelog](https://github.com/auth0/auth0-cli/compare/v1.0.0-beta.1...v1.0.0-beta.2)

### Added

Expand All @@ -109,7 +115,9 @@ Refer to the [v1 migration guide](MIGRATION_GUIDE.md) for instructions on how to

- Apps shown in multi select when no app-id is passed [#648]

## [1.0.0-beta.1](https://github.com/auth0/auth0-cli/tree/1.0.0-beta.1) (Jan 20, 2023)
## [v1.0.0-beta.1](https://github.com/auth0/auth0-cli/tree/v1.0.0-beta.1) (Jan 20, 2023)

[Full Changelog](https://github.com/auth0/auth0-cli/compare/v0.13.1...v1.0.0-beta.1)

### Added

Expand Down Expand Up @@ -160,6 +168,7 @@ Refer to the [v1 migration guide](MIGRATION_GUIDE.md) for instructions on how to
- `auth0 tenants add` command in favor of `auth0 login` [#546]
- Updating of action triggers which inevitably results in error [#597]

[unreleased]: https://github.com/auth0/auth0-cli/compare/v1.0.0...HEAD
[#733]: https://github.com/auth0/auth0-cli/issues/733
[#735]: https://github.com/auth0/auth0-cli/issues/735
[#736]: https://github.com/auth0/auth0-cli/issues/736
Expand Down
14 changes: 7 additions & 7 deletions docs/auth0_users_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ auth0 users create [flags]
auth0 users create
auth0 users create --name "John Doe"
auth0 users create --name "John Doe" --email [email protected]
auth0 users create --name "John Doe" --email [email protected] --connection "Username-Password-Authentication" --username "example"
auth0 users create --name "John Doe" --email [email protected] --connection-name "Username-Password-Authentication" --username "example"
auth0 users create -n "John Doe" -e [email protected] -c "Username-Password-Authentication" -u "example" --json
```


## Flags

```
-c, --connection string Name of the database connection this user should be created in.
-e, --email string The user's email.
--json Output in json format.
-n, --name string The user's full name.
-p, --password string Initial password for this user (mandatory for non-SMS connections).
-u, --username string The user's username. Only valid if the connection requires a username.
-c, --connection-name string Name of the database connection this user should be created in.
-e, --email string The user's email.
--json Output in json format.
-n, --name string The user's full name.
-p, --password string Initial password for this user (mandatory for non-SMS connections).
-u, --username string The user's username. Only valid if the connection requires a username.
```


Expand Down
10 changes: 5 additions & 5 deletions docs/auth0_users_import.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ auth0 users import [flags]
## Flags

```
-c, --connection string Name of the database connection this user should be created in.
--email-results When true, sends a completion email to all tenant owners when the job is finished. The default is true, so you must explicitly set this parameter to false if you do not want emails sent. (default true)
-t, --template string Name of JSON example to be used. Cannot be used if the '--users' flag is passed. Options include: 'Empty', 'Basic Example', 'Custom Password Hash Example' and 'MFA Factors Example'.
--upsert When set to false, pre-existing users that match on email address, user ID, or username will fail. When set to true, pre-existing users that match on any of these fields will be updated, but only with upsertable attributes.
-u, --users string JSON payload that contains an array of user(s) to be imported. Cannot be used if the '--template' flag is passed.
-c, --connection-name string Name of the database connection this user should be created in.
--email-results When true, sends a completion email to all tenant owners when the job is finished. The default is true, so you must explicitly set this parameter to false if you do not want emails sent. (default true)
-t, --template string Name of JSON example to be used. Cannot be used if the '--users' flag is passed. Options include: 'Empty', 'Basic Example', 'Custom Password Hash Example' and 'MFA Factors Example'.
--upsert When set to false, pre-existing users that match on email address, user ID, or username will fail. When set to true, pre-existing users that match on any of these fields will be updated, but only with upsertable attributes.
-u, --users string JSON payload that contains an array of user(s) to be imported. Cannot be used if the '--template' flag is passed.
```


Expand Down
10 changes: 5 additions & 5 deletions docs/auth0_users_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ auth0 users update [flags]
## Flags

```
-c, --connection string Name of the database connection this user should be created in.
-e, --email string The user's email.
--json Output in json format.
-n, --name string The user's full name.
-p, --password string Initial password for this user (mandatory for non-SMS connections).
-c, --connection-name string Name of the database connection this user should be created in.
-e, --email string The user's email.
--json Output in json format.
-n, --name string The user's full name.
-p, --password string Initial password for this user (mandatory for non-SMS connections).
```


Expand Down
54 changes: 27 additions & 27 deletions internal/cli/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ var (
Help: "Id of the user.",
}

userConnection = Flag{
Name: "Connection",
LongForm: "connection",
userConnectionName = Flag{
Name: "Connection Name",
LongForm: "connection-name",
ShortForm: "c",
Help: "Name of the database connection this user should be created in.",
IsRequired: true,
Expand Down Expand Up @@ -209,11 +209,11 @@ func searchUsersCmd(cli *cli) *cobra.Command {

func createUserCmd(cli *cli) *cobra.Command {
var inputs struct {
Connection string
Email string
Password string
Username string
Name string
ConnectionName string
Email string
Password string
Username string
Name string
}

cmd := &cobra.Command{
Expand All @@ -226,7 +226,7 @@ func createUserCmd(cli *cli) *cobra.Command {
Example: ` auth0 users create
auth0 users create --name "John Doe"
auth0 users create --name "John Doe" --email [email protected]
auth0 users create --name "John Doe" --email [email protected] --connection "Username-Password-Authentication" --username "example"
auth0 users create --name "John Doe" --email [email protected] --connection-name "Username-Password-Authentication" --username "example"
auth0 users create -n "John Doe" -e [email protected] -c "Username-Password-Authentication" -u "example" --json`,
RunE: func(cmd *cobra.Command, args []string) error {
// Users API currently only supports database connections.
Expand All @@ -235,7 +235,7 @@ func createUserCmd(cli *cli) *cobra.Command {
return err
}

if err := userConnection.Select(cmd, &inputs.Connection, options, nil); err != nil {
if err := userConnectionName.Select(cmd, &inputs.ConnectionName, options, nil); err != nil {
return err
}

Expand All @@ -249,20 +249,20 @@ func createUserCmd(cli *cli) *cobra.Command {
return err
}

// //Prompt for user password
// Prompt for user password
if err := userPassword.AskPassword(cmd, &inputs.Password); err != nil {
return err
}

// The getConnReqUsername returns the value for the requires_username field for the selected connection
// The result will be used to determine whether to prompt for username
conn := cli.getConnReqUsername(auth0.StringValue(&inputs.Connection))
conn := cli.getConnReqUsername(auth0.StringValue(&inputs.ConnectionName))
requireUsername := auth0.BoolValue(conn)

// Prompt for username if the requireUsername is set to true
// Load values including the username's field into a fresh users instance
a := &management.User{
Connection: &inputs.Connection,
Connection: &inputs.ConnectionName,
Email: &inputs.Email,
Name: &inputs.Name,
Password: &inputs.Password,
Expand Down Expand Up @@ -290,7 +290,7 @@ func createUserCmd(cli *cli) *cobra.Command {

cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.")
userName.RegisterString(cmd, &inputs.Name, "")
userConnection.RegisterString(cmd, &inputs.Connection, "")
userConnectionName.RegisterString(cmd, &inputs.ConnectionName, "")
userPassword.RegisterString(cmd, &inputs.Password, "")
userEmail.RegisterString(cmd, &inputs.Email, "")
userUsername.RegisterString(cmd, &inputs.Username, "")
Expand Down Expand Up @@ -399,11 +399,11 @@ func deleteUserCmd(cli *cli) *cobra.Command {

func updateUserCmd(cli *cli) *cobra.Command {
var inputs struct {
ID string
Email string
Password string
Name string
Connection string
ID string
Email string
Password string
Name string
ConnectionName string
}

cmd := &cobra.Command{
Expand Down Expand Up @@ -473,10 +473,10 @@ func updateUserCmd(cli *cli) *cobra.Command {
user.Password = &inputs.Password
}

if len(inputs.Connection) == 0 {
if len(inputs.ConnectionName) == 0 {
user.Connection = current.Connection
} else {
user.Connection = &inputs.Connection
user.Connection = &inputs.ConnectionName
}

if err := ansi.Waiting(func() error {
Expand All @@ -495,7 +495,7 @@ func updateUserCmd(cli *cli) *cobra.Command {

cmd.Flags().BoolVar(&cli.json, "json", false, "Output in json format.")
userName.RegisterStringU(cmd, &inputs.Name, "")
userConnection.RegisterStringU(cmd, &inputs.Connection, "")
userConnectionName.RegisterStringU(cmd, &inputs.ConnectionName, "")
userPassword.RegisterStringU(cmd, &inputs.Password, "")
userEmail.RegisterStringU(cmd, &inputs.Email, "")

Expand Down Expand Up @@ -533,7 +533,7 @@ func openUserCmd(cli *cli) *cobra.Command {

func importUsersCmd(cli *cli) *cobra.Command {
var inputs struct {
Connection string
ConnectionName string
ConnectionID string
Template string
UsersBody string
Expand Down Expand Up @@ -567,13 +567,13 @@ The file size limit for a bulk import is 500KB. You will need to start multiple
return err
}

if err := userConnection.Select(cmd, &inputs.Connection, dbConnectionOptions, nil); err != nil {
if err := userConnectionName.Select(cmd, &inputs.ConnectionName, dbConnectionOptions, nil); err != nil {
return err
}

connection, err := cli.api.Connection.ReadByName(inputs.Connection)
connection, err := cli.api.Connection.ReadByName(inputs.ConnectionName)
if err != nil {
return fmt.Errorf("failed to find connection with name %q: %w", inputs.Connection, err)
return fmt.Errorf("failed to find connection with name %q: %w", inputs.ConnectionName, err)
}

inputs.ConnectionID = connection.GetID()
Expand Down Expand Up @@ -640,7 +640,7 @@ The file size limit for a bulk import is 500KB. You will need to start multiple
},
}

userConnection.RegisterString(cmd, &inputs.Connection, "")
userConnectionName.RegisterString(cmd, &inputs.ConnectionName, "")
userImportTemplate.RegisterString(cmd, &inputs.Template, "")
userImportBody.RegisterString(cmd, &inputs.UsersBody, "")
userEmailResults.RegisterBool(cmd, &inputs.SendCompletionEmail, true)
Expand Down
6 changes: 3 additions & 3 deletions test/integration/users-test-cases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ config:

tests:
001 - users create and check data:
command: auth0 users create --name integration-test-user-new --connection Username-Password-Authentication --email [email protected] --password testUser12 --username testuser1 --json --no-input
command: auth0 users create --name integration-test-user-new --connection-name Username-Password-Authentication --email [email protected] --password testUser12 --username testuser1 --json --no-input
exit-code: 0
stdout:
json:
email: "[email protected]"
connection: "Username-Password-Authentication"

002 - users create and check output:
command: auth0 users create --name integration-test-user-new2 --connection Username-Password-Authentication --email [email protected] --password testUser12 --username testuser2 --no-input
command: auth0 users create --name integration-test-user-new2 --connection-name Username-Password-Authentication --email [email protected] --password testUser12 --username testuser2 --no-input
exit-code: 0
stdout:
contains:
Expand Down Expand Up @@ -67,7 +67,7 @@ tests:
exit-code: 0

009 - users update maximal flags:
command: auth0 users update $(./test/integration/scripts/get-user-id.sh) --email [email protected] --connection Username-Password-Authentication --name integration-test-user-bettername --json --no-input
command: auth0 users update $(./test/integration/scripts/get-user-id.sh) --email [email protected] --connection-name Username-Password-Authentication --name integration-test-user-bettername --json --no-input
stdout:
json:
email: [email protected]
Expand Down

0 comments on commit 3aa6bad

Please sign in to comment.