Files
ilkerandClaude Opus 5 262921f5df hpcod: delete an account, for the ones that were never a person
Disabling is the right answer for somebody who has left: it keeps the
record of who registered, who decided and when, which is the point of
having the trail. It is the wrong answer for an account opened to
check that a page works. Ten of those had accumulated on this estate,
each one disabled and each one still in the list.

Two refusals, both in the same transaction as the delete so two
administrators racing cannot step through the gap.

The last active administrator, because nothing else in the system can
grant admin and removing the last one locks everybody out of the
accounts page for good.

An account whose tenant still holds a cluster. The cluster would go
on running, owned by a name nobody can sign in as and reachable by
administrators alone, and the person it belongs to could not release
it. The message says how many and to release them first.

The page keeps the rule the other actions keep - you cannot decide on
your own account - and says in one line when to disable and when to
delete, because the difference is not obvious from two buttons side
by side. The command line takes -delete, and deliberately does not
ask for -by: there is nothing left to attribute the decision to.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 09:24:06 +02:00

77 lines
3.8 KiB
HTML

{{define "accounts.html"}}<!doctype html>
<html lang="en"><head>{{template "head" .}}<title>Accounts · HPC on Demand</title></head>
<body>
{{template "nav" .}}
<main>
<h1>Accounts</h1>
<p class="deck">Everyone who has registered. A new account cannot sign in until
it is approved here; pending ones are listed first.</p>
{{if .Err}}<div class="note crit"><p>{{.Err}}</p></div>{{end}}
{{if .Accounts}}
<div class="card">
<table>
<thead><tr>
<th>Username</th><th>Email</th><th>Reason</th><th>State</th>
<th>Registered</th><th>Decided</th><th>Actions</th>
</tr></thead>
<tbody>
{{range .Accounts}}
<tr>
<td><code>{{.Username}}</code>{{if .IsAdmin}} <span class="pill warn">admin</span>{{end}}</td>
<td>{{if .Email}}{{.Email}}{{else}}<span class="age">—</span>{{end}}</td>
<td>{{if .Reason}}{{.Reason}}{{else}}<span class="age">—</span>{{end}}</td>
<td><span class="pill {{if .Active}}ok{{else if .Pending}}warn{{else}}crit{{end}}">{{.State}}</span></td>
<td class="age">{{.CreatedAt.Format "2006-01-02"}}</td>
<td class="age">{{if .DecidedBy}}{{.DecidedBy}}{{else}}—{{end}}</td>
<td>
{{if not .Active}}
<form method="post" action="/admin/accounts" class="inline">
<input type="hidden" name="username" value="{{.Username}}">
<input type="hidden" name="do" value="approve">
<button type="submit" class="small">Approve</button>
</form>
{{end}}
{{if ne .State "disabled"}}
<form method="post" action="/admin/accounts" class="inline"
onsubmit="return confirm('Disable {{.Username}}? They will not be able to sign in.')">
<input type="hidden" name="username" value="{{.Username}}">
<input type="hidden" name="do" value="disable">
<button type="submit" class="small danger">Disable</button>
</form>
{{end}}
{{if .Active}}
<form method="post" action="/admin/accounts" class="inline"
onsubmit="return confirm('{{if .IsAdmin}}Revoke admin from{{else}}Make {{.Username}} an administrator?{{end}} {{.Username}}?')">
<input type="hidden" name="username" value="{{.Username}}">
<input type="hidden" name="do" value="{{if .IsAdmin}}revoke-admin{{else}}grant-admin{{end}}">
<button type="submit" class="small">{{if .IsAdmin}}Revoke admin{{else}}Make admin{{end}}</button>
</form>
{{end}}
<form method="post" action="/admin/accounts" class="inline"
onsubmit="return confirm('Delete {{.Username}}? The account and its record of who approved it are removed for good. Disable it instead if you want the trail kept.')">
<input type="hidden" name="username" value="{{.Username}}">
<input type="hidden" name="do" value="delete">
<button type="submit" class="small danger">Delete</button>
</form>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
<div class="note"><p>You cannot decide on your own account: that would either
do nothing or lock the last administrator out. <strong>Disable</strong> keeps
the record of who registered and who decided, which is what you want for
somebody who has left. <strong>Delete</strong> removes the account outright,
for the ones opened to verify something and never used by a person - it is
refused for the last administrator, and for anyone still holding a
cluster.</p></div>
{{else if not .Err}}
<div class="card"><div class="card-b"><p style="margin:0">Nobody has registered yet.</p></div></div>
{{end}}
</main>
</body></html>
{{end}}