MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / printUserRows

Function printUserRows

core/cmd/server/cmd/user.go:90–114  ·  view source on GitHub ↗
(rows []enterpriseUserRow)

Source from the content-addressed store, hash-verified

88}
89
90func printUserRows(rows []enterpriseUserRow) error {
91 headers := []string{
92 i18n.GetMsgByKeyForCmd("UserTableName"),
93 i18n.GetMsgByKeyForCmd("UserTableMFAStatus"),
94 i18n.GetMsgByKeyForCmd("UserTableSuperAdmin"),
95 i18n.GetMsgByKeyForCmd("UserTableCreatedAt"),
96 }
97 widths := make([]int, len(headers))
98 for i, header := range headers {
99 widths[i] = displayWidth(header)
100 }
101 for _, row := range rows {
102 values := []string{row.Name, row.MFAStatus, row.SuperAdmin, row.CreatedAt}
103 for i, value := range values {
104 if w := displayWidth(value); w > widths[i] {
105 widths[i] = w
106 }
107 }
108 }
109 fmt.Println(joinColumns(headers, widths))
110 for _, row := range rows {
111 fmt.Println(joinColumns([]string{row.Name, row.MFAStatus, row.SuperAdmin, row.CreatedAt}, widths))
112 }
113 return nil
114}
115
116func loadSettingRecord(db *gorm.DB, key string) (setting, error) {
117 var record setting

Callers 2

listEnterpriseUsersFunction · 0.85
listCommunityUsersFunction · 0.85

Calls 2

displayWidthFunction · 0.85
joinColumnsFunction · 0.85

Tested by

no test coverage detected