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

Method databaseAndPasswordlessConnectionOptions

internal/cli/users.go:993–1023  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

991}
992
993func (c *cli) databaseAndPasswordlessConnectionOptions(ctx context.Context) ([]string, error) {
994 connectionList, err := c.api.Connection.List(
995 ctx,
996 management.Parameter("strategy[0]", management.ConnectionStrategyAuth0),
997 management.Parameter("strategy[1]", management.ConnectionStrategyEmail),
998 management.Parameter("strategy[2]", management.ConnectionStrategySMS),
999 management.PerPage(100),
1000 )
1001 if err != nil {
1002 return nil, err
1003 }
1004
1005 var connectionNames []string
1006 for _, connection := range connectionList.Connections {
1007 hasClients, err := connectionHasEnabledClients(ctx, c.api.Connection, connection.GetID())
1008 if err != nil {
1009 continue
1010 }
1011 if !hasClients {
1012 continue
1013 }
1014
1015 connectionNames = append(connectionNames, connection.GetName())
1016 }
1017
1018 if len(connectionNames) == 0 {
1019 return nil, errors.New("there are currently no active database or passwordless connections to choose from")
1020 }
1021
1022 return connectionNames, nil
1023}
1024
1025// connectionHasEnabledClients checks if a connection has any enabled clients
1026// using the dedicated endpoint (replaces deprecated enabled_clients field).

Callers 3

createUserCmdFunction · 0.80
importUsersCmdFunction · 0.80

Calls 3

ListMethod · 0.65
GetNameMethod · 0.65

Tested by 1