# admin

The admin page a program needs for its own people, in the program's own
back end. The whole of it is [docs/admin.md](../../docs/admin.md).

```toml
# mote.toml
[packages]
admin = "../mote/extensions/admin"
```

```text
app "Shop"
use "pkg:admin/admin.mote"

rule admin = exists(Member, {who: me, role: "admin"})

route "/admin"
  AdminPanel
```

| File | |
|---|---|
| `admin.mote` | The models (`AdminProbe`, `AdminLog`, `AdminFault`), the settings, and the `server fn`s, each `requires admin`: `adminRows`, `adminRow`, `adminSet`, `adminPeople`, `adminActAs`, `adminJobs`, `adminHealth` and the rest. |
| `panel.mote` | `AdminPanel`, `AdminPeople`, `AdminData`, `AdminJobs`, `AdminHealth`, `AdminAccess`, `AdminTrail`, `AdminTab`. Taken by `admin.mote`. |
| `usage.mote` | The usage extension's panel as a tab: `use "pkg:admin/usage.mote"` in a program that takes both. |
| `stripe.mote` | The Stripe extension's billing panel as a "Billing" tab: `use "pkg:admin/stripe.mote"` in a program that takes both. |
| `tests.mote` | Its tests: `use "pkg:admin/tests.mote"` in a program whose rule is `me.email in setting.list("ADMIN_EMAILS")`, then `mote test` (each test says the settings it runs with: `given env`). |

Settings: `ADMIN_EMAILS`, `ADMIN_READ_ALL`, `ADMIN_SHOW_HIDDEN`,
`ADMIN_ACT_WRITE`, `ADMIN_ACT_ADMINS`, `ADMIN_KEEP_FAULTS` (200).
