netlify / gotrue

An SWT based API for managing users and issuing SWT tokens.
https://www.gotrueapi.org
MIT License
3.84k stars 285 forks source link

admin createuser fails #197

Closed ghost closed 3 years ago

ghost commented 5 years ago

- Do you want to request a feature or report a bug? bug

- What is the current behavior?

Creation of User fails via the admin createuser command:

panic: uuid: incorrect UUID length: 

goroutine 1 [running]:
github.com/gofrs/uuid.Must(...)
    /home/hfte/go/pkg/mod/github.com/gofrs/uuid@v3.1.0+incompatible/uuid.go:186
github.com/gobuffalo/uuid.Must(...)
    /home/hfte/go/pkg/mod/github.com/gobuffalo/uuid@v2.0.5+incompatible/uuid.go:85
github.com/netlify/gotrue/cmd.adminCreateUser(0xc0000e6900, 0xc00013c400, 0xc00000cd40, 0x2, 0x2)
    /home/hfte/gopath/src/github.com/netlify/gotrue/cmd/admin_cmd.go:71 +0x628
github.com/netlify/gotrue/cmd.execWithConfigAndArgs(0x1524cc0, 0xe3f450, 0xc00000cd40, 0x2, 0x2)
    /home/hfte/gopath/src/github.com/netlify/gotrue/cmd/root_cmd.go:50 +0x166
github.com/netlify/gotrue/cmd.glob..func1(0x1524cc0, 0xc00000cd40, 0x2, 0x2)
    /home/hfte/gopath/src/github.com/netlify/gotrue/cmd/admin_cmd.go:47 +0xa9
github.com/spf13/cobra.(*Command).execute(0x1524cc0, 0xc00000ccc0, 0x2, 0x2, 0x1524cc0, 0xc00000ccc0)
    /home/hfte/go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:766 +0x2cc
github.com/spf13/cobra.(*Command).ExecuteC(0x1525640, 0x15253e0, 0x1525b00, 0xc000336a00)
    /home/hfte/go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:852 +0x2fd
github.com/spf13/cobra.(*Command).Execute(0x1525640, 0x0, 0x0)
    /home/hfte/go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:800 +0x2b
main.main()
    /home/hfte/gopath/src/github.com/netlify/gotrue/main.go:10 +0x27

- If the current behavior is a bug, please provide the steps to reproduce. ./gotrue admin createuser mail@example.com my_pass

- What is the expected behavior? Creation of User Suceeds

- Please mention your Go version, and operating system version. go version go1.11.3 linux/amd64

bandirsen commented 5 years ago

https://github.com/netlify/gotrue/pull/188#issuecomment-435651982

ghost commented 5 years ago

#188 (comment)

I had to apply your patch indeed, before being able to compile it.

ghost commented 5 years ago

Info: My instanceID is zero. But I don't have control, over this, do I?

edevil commented 5 years ago

@hfte Isn't the instance id a value that can be passed as a flag?

  -i, --instance_id string   Set the instance ID to interact with

Seems to want a UUID as a string.

fodkastir commented 5 years ago

any updates on this issue?

ghost commented 5 years ago

@hfte Isn't the instance id a value that can be passed as a flag?

  -i, --instance_id string   Set the instance ID to interact with

Seems to want a UUID as a string.

That's possible indeed. Thanks. Note that for non multi-tenant cases the UUID of you only Instance will be all zeros. Looked it up in the database, to be sure.

./gotrue admin createuser -i 00000000-0000-0000-0000-000000000000 mail@example.com password

It would be handy to have an -a --admin flag for the createuser command.

Am I guessing right that an admin can only add and edit users in it's own instance, whereas a superadmin has rights for all instances?

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had activity in 1 year. It will be closed in 7 days if no further activity occurs. Thanks!

github-actions[bot] commented 3 years ago

This issue was closed because it had no activity for over 1 year.