Add deactivation status to mmctl user search output (#30379)

Этот коммит содержится в:
Ben Schumacher
2025-05-13 08:52:13 +02:00
коммит произвёл GitHub
родитель a8a2ae3af0
Коммит e1c94e7b63
3 изменённых файлов: 56 добавлений и 5 удалений

Просмотреть файл

@@ -775,6 +775,12 @@ func deleteAllUsersCmdF(c client.Client, cmd *cobra.Command, args []string) erro
return nil
}
// userOut is the output format for users.
type userOut struct {
*model.User
Deactivated bool
}
func searchUserCmdF(c client.Client, cmd *cobra.Command, args []string) error {
printer.SetSingle(true)
@@ -789,7 +795,12 @@ func searchUserCmdF(c client.Client, cmd *cobra.Command, args []string) error {
}
for i, user := range users {
uout := userOut{
User: user,
Deactivated: !(user.DeleteAt == 0),
}
tpl := `id: {{.Id}}
deactivated: {{.Deactivated}}
username: {{.Username}}
nickname: {{.Nickname}}
position: {{.Position}}
@@ -801,7 +812,7 @@ auth_service: {{.AuthService}}`
tpl = "------------------------------\n" + tpl
}
printer.PrintT(tpl, user)
printer.PrintT(tpl, uout)
}
return nil