Files
kopia/cli/command_user.go
Julio López 9c5fc842a1 feat(cli): add server user set-password-hash command (#3974)
Objectives:
- Facilitate the generation of valid password hashes that can be used with
  the `server user --user-password` CLI command.
- Encapsulate implementation details of password hashing in
  the `user` package.

Adds a new `server user hash-password` CLI command to generate the
hash from a supplied password.

Modifies the `server user set/add --user-password-hash` CLI command
to accept the password hash generated using the `hash-password`
command.

Adds `GetNewProfile(ctx, rep, username)` helper to move implementation
details to the `user` package.

Includes CLI and unit tests.

Cleans up and removes unused functions.
2024-07-11 19:29:06 -07:00

22 lines
551 B
Go

package cli
type commandServerUser struct {
add commandServerUserAddSet
set commandServerUserAddSet
delete commandServerUserDelete
hash commandServerUserHashPassword
info commandServerUserInfo
list commandServerUserList
}
func (c *commandServerUser) setup(svc appServices, parent commandParent) {
cmd := parent.Command("users", "Manager repository users").Alias("user")
c.add.setup(svc, cmd, true)
c.set.setup(svc, cmd, false)
c.delete.setup(svc, cmd)
c.hash.setup(svc, cmd)
c.info.setup(svc, cmd)
c.list.setup(svc, cmd)
}