vole
Clone
Read only, no credentials:
https://rodent.software/git/vole.git
Write over SSH with a registered key:
git clone ssh://git@0.0.0.0:2222/vole.git
A free and open-source forge that lives in your Git repo.
Manage accounts from the users directory, not the Admin tab
ea21f923d1fabe3a633e3dc4713ca18d211dbfcb · Keenan Nemetz · 4d ago · parent f11854fe
Manage accounts from the users directory, not the Admin tab The Accounts tab rendered every account in the roster, which costs more as an instance grows and duplicates a directory that is already paginated, searchable, filterable, and sortable. The tab now keeps the invite and bot forms and points at /u, and an instance admin gets a Manage action on each directory row that opens the account page. The Manage column is presentation only: the account page still checks the instance-admin role, so a non-admin who types its URL gets the usual 404. Refs #198 (01M6MK0NNZ2XR1D5TQKNWYT4HN).
server/web/admin_users.go −23
| @@ -15,11 +15,6 @@ import ( | |||
| 15 | 15 | "github.com/rodent-software/vole/forge/session" | |
| 16 | 16 | ) | |
| 17 | 17 | ||
| 18 | type adminUserRow struct { | ||
| 19 | Account *identity.Account | ||
| 20 | Sessions int | ||
| 21 | } | ||
| 22 | |||
| 23 | 18 | type adminUserView struct { | |
| 24 | 19 | Page | |
| 25 | 20 | Account *identity.Account | |
| @@ -39,24 +34,6 @@ type adminInviteView struct { | |||
| 39 | 34 | BrowserLogin bool | |
| 40 | 35 | } | |
| 41 | 36 | ||
| 42 | // adminUserRows is the roster table on the Accounts tab. The session count is a | ||
| 43 | // read of each account's sessions, so it follows the same rule the account page | ||
| 44 | // does: a failure shows zero rather than failing the roster. | ||
| 45 | func (w *Web) adminUserRows() []adminUserRow { | ||
| 46 | accounts := w.Ident.All() | ||
| 47 | rows := make([]adminUserRow, 0, len(accounts)) | ||
| 48 | for _, acct := range accounts { | ||
| 49 | row := adminUserRow{Account: acct} | ||
| 50 | if w.Sessions != nil { | ||
| 51 | if list, err := w.Sessions.List(acct.Name); err == nil { | ||
| 52 | row.Sessions = len(list) | ||
| 53 | } | ||
| 54 | } | ||
| 55 | rows = append(rows, row) | ||
| 56 | } | ||
| 57 | return rows | ||
| 58 | } | ||
| 59 | |||
| 60 | 37 | func (w *Web) adminUserView(r *http.Request, acct *identity.Account, msg string) adminUserView { | |
| 61 | 38 | v := adminUserView{ | |
| 62 | 39 | Page: w.page(r, acct.Name), Account: acct, Error: msg, | |