feat(office): users admin UI, table rendering, and user save fixes

Add Users list/detail with ACL toggles and library people update/status APIs.
Fix project table layout and ANSI-safe cell rendering, and decode array
responses from people/status so saves no longer fail on JSON unmarshal.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-25 11:07:22 +01:00
co-authored by Cursor
parent 72844dfe24
commit 40b74eb8ab
45 changed files with 3012 additions and 438 deletions
+69
View File
@@ -0,0 +1,69 @@
package ui
import "github.com/eslider/go-onlyoffice/cmd/office/model"
const (
userMinEmailWidth = 16
userMinFixedWidth = 3
)
// layoutUserTable shows every user column; email absorbs leftover width.
func layoutUserTable(cols []model.TableColumn, totalW int) columnLayout {
indices := make([]int, len(cols))
for i := range cols {
indices[i] = i
}
widths := make(map[int]int, len(cols))
emailIdx := -1
fixed := 0
for i, col := range cols {
if col.Key == "email" {
emailIdx = i
continue
}
widths[i] = col.Width
fixed += widths[i]
}
if emailIdx < 0 {
return layoutScrollingTable(cols, 0, totalW)
}
emailW := totalW - fixed
if emailW < userMinEmailWidth {
shrinkUserFixedColumns(widths, indices, emailIdx, fixed+userMinEmailWidth-totalW)
fixed = 0
for _, i := range indices {
if i != emailIdx {
fixed += widths[i]
}
}
emailW = totalW - fixed
if emailW < userMinEmailWidth {
emailW = userMinEmailWidth
}
}
widths[emailIdx] = emailW
normalizeWidthSum(widths, indices, totalW, emailIdx)
return columnLayout{indices: indices, widths: widths}
}
func shrinkUserFixedColumns(widths map[int]int, indices []int, emailIdx, need int) {
for need > 0 {
changed := false
for _, i := range indices {
if i == emailIdx || widths[i] <= userMinFixedWidth {
continue
}
widths[i]--
need--
changed = true
if need == 0 {
return
}
}
if !changed {
return
}
}
}