internal/web/templates/adminusers.html

419f6dfdc5489a0c6374e36dd1ebbfca68040056
gitbay/internal/web/templates/adminusers.html history · blame · raw

75 lines · 4012 bytes

 1{{define "width"}}bounded{{end}}
 2{{define "title"}}accounts · admin · {{.Site}}{{end}}
 3{{define "content"}}
 4<h1>Accounts</h1>
 5<p class="meta"><a href="/admin">Admin</a> · the same read as <code>gitbay admin user list</code>.</p>
 6{{if .Notice}}<p class="notice" role="status">{{.Notice}}</p>{{end}}
 7
 8<nav class="filters">
 9  <a {{if eq .State "all"}}class="active" aria-current="page" {{end}}href="?state=all">all</a>
10  <a {{if eq .State "active"}}class="active" aria-current="page" {{end}}href="?state=active">active</a>
11  <a {{if eq .State "pending"}}class="active" aria-current="page" {{end}}href="?state=pending">pending</a>
12  <a {{if eq .State "disabled"}}class="active" aria-current="page" {{end}}href="?state=disabled">disabled</a>
13  <a {{if eq .State "admin"}}class="active" aria-current="page" {{end}}href="?state=admin">admins</a>
14</nav>
15
16{{if .Users}}<div class="tablewrap"><table class="keys accounts nowrap">
17<thead><tr class="cols"><th>Account</th><th>State</th><th>Created</th><th>Last seen</th><th>Actions</th></tr></thead>
18<tbody>
19{{range .Users}}<tr>
20  <td><a href="/{{.Username}}">{{.Username}}</a>{{if .Admin}} <span class="chip">admin</span>{{end}}</td>
21  <td><span class="chip {{if eq .State "active"}}chip-open{{else if eq .State "disabled"}}chip-closed{{else}}chip-neutral{{end}}">{{.State}}</span></td>
22  <td>{{when .CreatedAt}}</td>
23  <td>{{if .LastSeen}}{{when .LastSeen}}{{else}}never{{end}}</td>
24  <td>
25    {{if .Admin}}
26    <form method="post" action="/admin/users" class="actions">
27      <input type="hidden" name="field" value="demote">
28      <input type="hidden" name="user" value="{{.Username}}">
29      <input type="hidden" name="state" value="{{$.State}}">
30      {{template "confirmfield" .Username}} <button type="submit" class="btn">Demote</button>
31    </form>
32    {{else if eq .State "active"}}
33    <form method="post" action="/admin/users" class="actions">
34      <input type="hidden" name="field" value="promote">
35      <input type="hidden" name="user" value="{{.Username}}">
36      <input type="hidden" name="state" value="{{$.State}}">
37      <button type="submit" class="btn">Promote</button>
38    </form>
39    {{else}}
40    {{/* An account that is not active cannot be promoted, but the row
41         still draws the control so every Actions cell is the same
42         shape. Both parts are disabled, so the form never posts. */}}
43    <form method="post" action="/admin/users" class="actions" title="Only an active account can be promoted">
44      <input type="text" name="confirm" aria-label="Type {{.Username}} to confirm" placeholder="type {{.Username}} to confirm" size="{{len .Username}}" autocomplete="off" disabled>
45      <button type="submit" class="btn" disabled>Promote</button>
46    </form>
47    {{end}}
48    {{if eq .State "disabled"}}
49    <form method="post" action="/admin/users" class="actions">
50      <input type="hidden" name="field" value="enable">
51      <input type="hidden" name="user" value="{{.Username}}">
52      <input type="hidden" name="state" value="{{$.State}}">
53      <button type="submit" class="btn">Enable</button>
54    </form>
55    {{else}}
56    <form method="post" action="/admin/users" class="actions">
57      <input type="hidden" name="field" value="disable">
58      <input type="hidden" name="user" value="{{.Username}}">
59      <input type="hidden" name="state" value="{{$.State}}">
60      {{template "confirmfield" .Username}} <button type="submit" class="btn">Disable</button>
61    </form>
62    {{end}}
63  </td>
64</tr>
65{{end}}
66</tbody></table></div>{{else}}<p class="none">No account matches</p>{{end}}
67{{if .Next}}<p class="pager"><a href="{{.Next}}">more →</a></p>{{end}}
68
69<p class="meta">Creating and deleting an account, issuing an invite and
70asserting an address stay on the command line: each takes a key, mints
71a credential, or cannot be undone.</p>
72<pre tabindex="0"><code>gitbay admin user create &lt;name&gt; --key - &lt; key.pub
73gitbay admin user delete &lt;name&gt; --yes
74gitbay admin invite --email &lt;address&gt;</code></pre>
75{{end}}