Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

A free and open-source forge that lives in your Git repo.

Add one Admin page with status, accounts, and the audit log

43e681d8a5d94567aa9530d32b2c89223c1a17f9 · Keenan Nemetz · 5d ago · parent af018ce8

Add one Admin page with status, accounts, and the audit log

Instance administration was split between the Status and Accounts pages,
and the audit log had no browser view at all. The new /admin page gathers
the status tabs, the account roster, and a read-only audit viewer into one
place with a tab for each, and /status, /runners, and /users redirect to
the tab they named so old links keep working.

The audit reader walks the file backwards a chunk at a time, returns the
newest records first, and shows one extra record to know whether an older
page exists. It skips a line it cannot parse rather than failing the page
and refuses a symlink or a non-regular file, as startup already does.

Refs #198 (01M6MK0NNZ2XR1D5TQKNWYT4HN).

server/web/templates/admin_audit.html +40

@@ -0,0 +1,40 @@
1 {{define "audit_body"}}
2 <h2 id="audit">Audit log</h2>
3 <p class="muted">
4 Every privileged action on this instance, newest first: account and key changes,
5 access rules, forced pushes and lock releases, admin commands, and browser writes.
6 This page only reads the log. The server appends to it, but anyone who can write
7 the data directory can edit it, so keep a copy off the host as well.
8 </p>
9
10 {{if .Audit.Err}}<div class="flash bad">The audit log could not be read: {{.Audit.Err}}</div>{{end}}
11
12 {{if .Audit.Entries}}
13 <div class="panel">
14 <table>
15 <thead><tr><th>When</th><th>Action</th><th>Actor</th><th>Subject</th><th>Detail</th></tr></thead>
16 <tbody>
17 {{range .Audit.Entries}}
18 <tr>
19 <td class="nowrap" title="{{.Time.UTC.Format "2006-01-02 15:04:05 UTC"}}">{{since .Time.Unix}}</td>
20 <td><code>{{.Action}}</code></td>
21 <td>{{template "userlink" (user .Actor)}}</td>
22 <td>{{.Subject}}</td>
23 <td class="muted audit-detail">{{.Detail}}</td>
24 </tr>
25 {{end}}
26 </tbody>
27 </table>
28 </div>
29 {{else if not .Audit.Err}}
30 <p class="muted">{{if gt .Audit.Page 1}}No entries on this page.{{else}}No privileged actions have been recorded yet.{{end}}</p>
31 {{end}}
32
33 {{if or .Audit.HasNewer .Audit.HasOlder}}
34 <nav class="pager" aria-label="Audit log pages">
35 {{if .Audit.HasNewer}}<a class="button secondary" href="{{.Audit.NewerURL}}">Newer</a>{{else}}<span></span>{{end}}
36 <span class="muted">Page {{.Audit.Page}}</span>
37 {{if .Audit.HasOlder}}<a class="button secondary" href="{{.Audit.OlderURL}}">Older</a>{{else}}<span></span>{{end}}
38 </nav>
39 {{end}}
40 {{end}}