✨ Add commands to remove logins and users
This commit is contained in:
parent
0ea1de332b
commit
5a8750e637
35
cmd_share.go
35
cmd_share.go
|
@ -34,11 +34,13 @@ import (
|
|||
)
|
||||
|
||||
type CmdShare struct {
|
||||
CmdList CmdShareList `cmd:"" name:"list" help:"List all shares."`
|
||||
CmdCreate CmdShareCreate `cmd:"" name:"create" help:"Create a new share."`
|
||||
CmdDelete CmdShareDelete `cmd:"" name:"delete" help:"Delete a share."`
|
||||
CmdAddUser CmdShareAddUser `cmd:"" name:"add-user" help:"Add user to share."`
|
||||
CmdAddLogin CmdShareAddLogin `cmd:"" name:"add-login" help:"Add login to share."`
|
||||
CmdList CmdShareList `cmd:"" name:"list" help:"List all shares."`
|
||||
CmdCreate CmdShareCreate `cmd:"" name:"create" help:"Create a new share."`
|
||||
CmdDelete CmdShareDelete `cmd:"" name:"delete" help:"Delete a share."`
|
||||
CmdAddUser CmdShareAddUser `cmd:"" name:"add-user" help:"Add user to share."`
|
||||
CmdAddLogin CmdShareAddLogin `cmd:"" name:"add-login" help:"Add login to share."`
|
||||
CmdRemoveUser CmdShareRemoveUser `cmd:"" name:"remove-user" help:"Remove user from share."`
|
||||
CmdRemoveLogin CmdShareRemoveLogin `cmd:"" name:"remove-login" help:"Remove login from share."`
|
||||
}
|
||||
|
||||
type CmdShareList struct{}
|
||||
|
@ -142,7 +144,7 @@ func (cmd *CmdShareAddUser) Run(app *app) error {
|
|||
type CmdShareAddLogin struct {
|
||||
ShareIdentifier
|
||||
Username string `arg:"" name:"username" help:"Username of the user to add the login for."`
|
||||
LoginName string `arg:"" name:"loginname" help:"Name f the login. Must be unique."`
|
||||
LoginName string `arg:"" name:"loginname" help:"Name of the login. Must be unique."`
|
||||
ReadOnly bool `name:"readonly" help:"If set, the login can only read."`
|
||||
PasswordParam
|
||||
}
|
||||
|
@ -166,3 +168,24 @@ func (cmd *CmdShareAddLogin) Run(app *app) error {
|
|||
|
||||
return app.shareStore.AddLogin(share, cmd.Username, login)
|
||||
}
|
||||
|
||||
type CmdShareRemoveUser struct {
|
||||
ShareIdentifier
|
||||
Username string `arg:"" name:"username" help:"Username of the user to remove."`
|
||||
}
|
||||
|
||||
func (cmd *CmdShareRemoveUser) Run(app *app) error {
|
||||
share := Share{UUID: cmd.UUID}
|
||||
return app.shareStore.RemoveUserFromShare(share, cmd.Username)
|
||||
}
|
||||
|
||||
type CmdShareRemoveLogin struct {
|
||||
ShareIdentifier
|
||||
Username string `arg:"" name:"username" help:"Username of the user to remove the login for."`
|
||||
LoginName string `arg:"" name:"loginname" help:"Name of the login to remove."`
|
||||
}
|
||||
|
||||
func (cmd *CmdShareRemoveLogin) Run(app *app) error {
|
||||
share := Share{UUID: cmd.UUID}
|
||||
return app.shareStore.RemoveLogin(share, cmd.Username, cmd.LoginName)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue