-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for setting password and org for a new user in the cli #15981
Conversation
c6448ac
to
15f3dd0
Compare
80dd3e5
to
c8e504c
Compare
@@ -17,21 +17,27 @@ import ( | |||
"github.com/spf13/viper" | |||
) | |||
|
|||
var influxCmd = &cobra.Command{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
want to make this noted, the init and global state are 100% not needed. Only adds side effects and indirection in this case. Creating constructors allows the ability to provide DI for testing (see pkg_test.go)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see any authorizer wrapped post password, can you wrap it into an authorizer, and add some tests in http package as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
||
// ComparePassword compares the user new password with existing. Note: is not implemented. | ||
func (s *PasswordService) ComparePassword(ctx context.Context, name string, password string) error { | ||
panic("not implemented") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -72,6 +73,10 @@ func NewUserHandler(b *UserBackend) *UserHandler { | |||
h.HandlerFunc("GET", usersLogPath, h.handleGetUserLog) | |||
h.HandlerFunc("PATCH", usersIDPath, h.handlePatchUser) | |||
h.HandlerFunc("DELETE", usersIDPath, h.handleDeleteUser) | |||
// the POST doesn't need to be nested under users in this scheme | |||
// seems worthwhile to make this a root resource in our HTTP API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can agree w/ this, seems kind of odd to have this nested under the /users/:id path when id
isn't used
ee0278b
to
81c39d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
81c39d7
to
091e6f8
Compare
one thing to note here is that new endpoint was created. there was no endpoint for setting an initial password that worked. The existin endpoint was a bit messy and coupled across multiple routes. Having multiple auth schemes proved incredibly taxing to write against.
091e6f8
to
af8cc9d
Compare
tests failing in idpe here, will have follow up PR in idpe to touch that up. This is an expected failure:
|
one thing to note here is that new endpoint was created. there was no
endpoint for setting an initial password that worked. The existing endpoint
was a bit messy and coupled across multiple routes. Having multiple auth
schemes proved incredibly taxing to write against.
update: this came up in discussion in another topic with @goller and from that conversation decided to fixup the password service interface here. To provide the user id instead of name as the first arg to each set/compare func in the PasswordService.
closes: #15977