✨ Add commands to remove logins and users
This commit is contained in:
parent
0ea1de332b
commit
5a8750e637
25
cmd_share.go
25
cmd_share.go
|
@ -39,6 +39,8 @@ type CmdShare struct {
|
||||||
CmdDelete CmdShareDelete `cmd:"" name:"delete" help:"Delete a share."`
|
CmdDelete CmdShareDelete `cmd:"" name:"delete" help:"Delete a share."`
|
||||||
CmdAddUser CmdShareAddUser `cmd:"" name:"add-user" help:"Add user to share."`
|
CmdAddUser CmdShareAddUser `cmd:"" name:"add-user" help:"Add user to share."`
|
||||||
CmdAddLogin CmdShareAddLogin `cmd:"" name:"add-login" help:"Add login 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{}
|
type CmdShareList struct{}
|
||||||
|
@ -142,7 +144,7 @@ func (cmd *CmdShareAddUser) Run(app *app) error {
|
||||||
type CmdShareAddLogin struct {
|
type CmdShareAddLogin struct {
|
||||||
ShareIdentifier
|
ShareIdentifier
|
||||||
Username string `arg:"" name:"username" help:"Username of the user to add the login for."`
|
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."`
|
ReadOnly bool `name:"readonly" help:"If set, the login can only read."`
|
||||||
PasswordParam
|
PasswordParam
|
||||||
}
|
}
|
||||||
|
@ -166,3 +168,24 @@ func (cmd *CmdShareAddLogin) Run(app *app) error {
|
||||||
|
|
||||||
return app.shareStore.AddLogin(share, cmd.Username, login)
|
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