List users and logins

This commit is contained in:
Andreas Schneider 2020-10-18 15:15:32 +02:00
parent b8181be096
commit 0ea1de332b
1 changed files with 20 additions and 0 deletions

View File

@ -51,6 +51,26 @@ func (cmd *CmdShareList) Run(app *app) error {
for _, share := range shares {
fmt.Printf("* %s (%s)\n", share.UUID.String(), share.Name)
shareUsers, err := app.shareStore.GetShareUsers(share)
if err != nil {
fmt.Printf(" !! Users cannot be listed: %v\n", err)
continue
}
for _, shareUser := range shareUsers {
fmt.Printf(" * User: %s (%s)\n", shareUser.Username, shareUser.Role)
shareLogins, err := app.shareStore.GetShareLogins(share, shareUser.Username)
if err != nil {
fmt.Printf(" !! Logins cannot be listed: %v\n", err)
continue
}
for _, shareLogin := range shareLogins {
info := ""
if shareLogin.ReadOnly {
info += " (readonly)"
}
fmt.Printf(" * Login: %s%s\n", shareLogin.LoginName, info)
}
}
}
return nil