| 1 |
{% extends "base.html" %} |
| 2 |
{% import "assistants_panel.html" as ai %} |
| 3 |
{% import "variables_panel.html" as va %} |
| 4 |
{% import "secrets_panel.html" as se %} |
| 5 |
{% block title %}Administration{% endblock %} |
| 6 |
{% block content %} |
| 7 |
<div class="head"><h1>Administration <small>{{ accounts.len() }} accounts · {{ orgs.len() }} organisations · {{ repos }} repositories</small></h1></div> |
| 8 |
<p><a class="go small" href="/admin/storage">Storage and maintenance</a> <a class="go small" href="/admin/runners">Runners</a></p> |
| 9 |
{% if let Some(n) = notice %}<p class="note">{{ n }}</p>{% endif %} |
| 10 |
<div class="side-layout"> |
| 11 |
<div> |
| 12 |
<section class="panel"> |
| 13 |
<h2>Accounts</h2> |
| 14 |
<table class="small"><tr><th>Username</th><th>Email</th><th>Flags</th><th>Last seen</th><th></th></tr> |
| 15 |
{% for a in accounts %} |
| 16 |
<tr><td><a href="/{{ a.username }}">{{ a.username }}</a></td><td>{{ a.email }}{% if !a.email.is_empty() %} <span class="small mute" title="{% if a.email_verified %}verified{% else %}not verified{% endif %}">{% if a.email_verified %}✔{% else %}○{% endif %}</span>{% endif %}</td><td>{% if a.is_admin %}<span class="tag">admin</span>{% endif %}{% if a.banned %} <span class="tag bad">banned</span>{% endif %}{% if a.disabled %} <span class="tag warn">disabled</span>{% endif %}{% if a.totp_enabled() %} <span class="tag">2fa</span>{% endif %}</td> |
| 17 |
<td>{% if a.last_seen_ms > 0 %}<time title="{{ a.last_seen_ms|when_i }}">{{ a.last_seen_ms|ago_i }}</time>{% else %}<span class="mute">never</span>{% endif %}</td> |
| 18 |
<td><form class="tiny" method="post" action="/admin/account"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><input type="hidden" name="username" value="{{ a.username }}"> |
| 19 |
{% if a.banned %}<button name="action" value="unban">unban</button>{% else %}<button name="action" value="ban">ban</button>{% endif %} |
| 20 |
{% if a.is_admin %}<button name="action" value="demote">demote</button>{% else %}<button name="action" value="promote">make admin</button>{% endif %} |
| 21 |
{% if a.disabled %}<button name="action" value="enable">enable</button>{% else %}<button name="action" value="disable" title="Refuse sign-in, sessions, tokens and pushes until enabled again">disable</button>{% endif %} |
| 22 |
{% if !a.blocked() %}<button name="action" value="reset_link" title="A one-time password reset link to hand over">reset link</button>{% endif %}</form> |
| 23 |
<details class="tiny delete-account"><summary>delete</summary><form class="tiny" method="post" action="/admin/account"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><input type="hidden" name="username" value="{{ a.username }}"> |
| 24 |
<label class="small">Deleting removes the account, its tokens, keys and memberships for good; what it wrote stays under its name, which stays retired. Type <strong>{{ a.username }}</strong> to confirm: |
| 25 |
<input name="confirm" autocomplete="off" required></label> <button class="danger" name="action" value="delete">delete {{ a.username }}</button></form></details></td></tr> |
| 26 |
{% endfor %} |
| 27 |
</table> |
| 28 |
</section> |
| 29 |
<section class="panel"> |
| 30 |
<h2>Audit log</h2> |
| 31 |
<table class="small"><tr><th>When</th><th>Who</th><th>Action</th><th>Target</th><th>Detail</th></tr> |
| 32 |
{% for r in audit %}<tr><td><time title="{{ r.at_ms|when_i }}">{{ r.at_ms|ago_i }}</time></td><td>{{ r.actor }}</td><td>{{ r.action }}</td><td>{{ r.target }}</td><td class="mute">{{ r.detail }}</td></tr>{% endfor %} |
| 33 |
</table> |
| 34 |
</section> |
| 35 |
</div> |
| 36 |
<aside class="side"> |
| 37 |
<h3>Registration</h3> |
| 38 |
<form class="card" method="post" action="/admin/registration"> |
| 39 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 40 |
<select name="mode">{% for m in ["open", "invite", "closed"] %}<option value="{{ m }}"{% if mode.as_str() == *m %} selected{% endif %}>{{ m }}</option>{% endfor %}</select> |
| 41 |
<button type="submit">SET</button> |
| 42 |
</form> |
| 43 |
<h3>Invitations</h3> |
| 44 |
<form class="card" method="post" action="/admin/invite"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button type="submit">NEW INVITATION</button></form> |
| 45 |
<ul class="plain small">{% for (code, used, at) in invitations %}<li><code>{{ code }}</code> {% if used.is_some() %}<span class="mute">used</span>{% else %}<a href="/register?invite={{ code }}">link</a>{% endif %} · {{ at|ago_i }}</li>{% endfor %}</ul> |
| 46 |
<h3>Organisations</h3> |
| 47 |
<ul class="plain">{% for o in orgs %}<li><a href="/orgs/{{ o.name }}/settings">{{ o.name }}</a></li>{% endfor %}</ul> |
| 48 |
<h3>Sign in with</h3> |
| 49 |
{% for p in providers %} |
| 50 |
<form class="card" method="post" action="/admin/signin"> |
| 51 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"><input type="hidden" name="provider" value="{{ p.id }}"> |
| 52 |
<h4>{{ p.name }} {% if p.enabled && p.has_secret && !p.client_id.is_empty() %}<span class="tag head">on</span>{% else %}<span class="tag dim">off</span>{% endif %}</h4> |
| 53 |
<label for="cid-{{ p.id }}">Client id</label><input type="text" id="cid-{{ p.id }}" name="client_id" value="{{ p.client_id }}" autocomplete="off"> |
| 54 |
<label for="sec-{{ p.id }}">Client secret</label><input type="password" id="sec-{{ p.id }}" name="secret" placeholder="{% if p.has_secret %}unchanged{% else %}none{% endif %}" autocomplete="new-password"> |
| 55 |
<div class="choice"><label><input type="checkbox" name="enabled" value="1"{% if p.enabled %} checked{% endif %}> on</label></div> |
| 56 |
<p class="small mute">Callback URL to register with {{ p.name }}: <code>{{ p.callback }}</code></p> |
| 57 |
<button type="submit">SAVE</button> |
| 58 |
</form> |
| 59 |
{% endfor %} |
| 60 |
<p class="small mute">A first sign-in links the account with the same verified email, or makes an account when registration is open. Secrets are kept sealed.</p> |
| 61 |
<h3>Mail</h3> |
| 62 |
<form class="card" method="post" action="/admin/mail"> |
| 63 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 64 |
<label>SMTP URL</label> |
| 65 |
<input type="text" name="smtp" value="{{ mail_smtp }}" placeholder="smtps://user:[email protected]:465"> |
| 66 |
<label>From</label> |
| 67 |
<input type="text" name="from" value="{{ mail_from }}" placeholder="OxygenHub <[email protected]>"> |
| 68 |
<button type="submit">SAVE</button> |
| 69 |
</form> |
| 70 |
<form class="card" method="post" action="/admin/mail/test"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button type="submit"{% if !mail_enabled || my_email.is_empty() %} disabled{% endif %}>SEND A TEST{% if !my_email.is_empty() %} TO {{ my_email }}{% endif %}</button></form> |
| 71 |
<p class="small mute">{% if mail_enabled %}Mail is on: verification and reset links go by email.{% else %}Mail is off: verification and reset links are issued by hand.{% endif %} An empty URL turns it off. The password stays on the server and is shown masked.</p> |
| 72 |
</aside> |
| 73 |
</div> |
| 74 |
{% call va::panel("/admin", variables, shell.csrf, "Every repository's jobs get these, unless an organisation or repository sets the same name.") %} |
| 75 |
{% call se::panel("/admin", secrets, shell.csrf, "Every repository's jobs may use these, unless an organisation or repository sets the same name.") %} |
| 76 |
{% call ai::panel("/admin", assistants, shell.csrf, "Every repository on the site may ask these, unless an organisation or repository turns one off.") %} |
| 77 |
{% endblock %} |