service: indicate which users are disabled in "user status"

This commit is contained in:
Simon Ser 2023-01-26 19:41:38 +01:00
parent d7d9d45b45
commit 05d7813835

View File

@ -895,9 +895,17 @@ func handleUserStatus(ctx *serviceContext, params []string) error {
ctx.user.srv.lock.Unlock()
for _, user := range users {
line := user.Username
var attrs []string
if user.Admin {
line += " (admin)"
attrs = append(attrs, "admin")
}
if !user.Enabled {
attrs = append(attrs, "disabled")
}
line := user.Username
if len(attrs) > 0 {
line += " (" + strings.Join(attrs, ", ") + ")"
}
networks, err := ctx.user.srv.db.ListNetworks(ctx, user.ID)
if err != nil {