mirror of
https://github.com/kopia/kopia.git
synced 2025-12-24 07:07:52 -05:00
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.
22 lines
551 B
Go
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)
|
|
}
|