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>
34 lines
718 B
Go
34 lines
718 B
Go
package fetch
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/eslider/go-onlyoffice/cmd/office/model"
|
|
)
|
|
|
|
// LoadUserChoices returns portal users for responsible pickers.
|
|
func (l *Loader) LoadUserChoices(ctx context.Context) ([]model.UserOption, error) {
|
|
if l == nil || l.Client == nil {
|
|
return nil, nil
|
|
}
|
|
users, err := l.Client.GetUsers()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
out := make([]model.UserOption, 0, len(users))
|
|
for _, u := range users {
|
|
if u == nil || u.ID == nil || *u.ID == "" {
|
|
continue
|
|
}
|
|
name := ""
|
|
if u.DisplayName != nil {
|
|
name = *u.DisplayName
|
|
}
|
|
if name == "" && u.Email != nil {
|
|
name = *u.Email
|
|
}
|
|
out = append(out, model.UserOption{ID: *u.ID, Name: name})
|
|
}
|
|
return out, nil
|
|
}
|