web permissions2

This commit is contained in:
Priec
2026-08-11 14:33:24 +02:00
parent 5602140d05
commit 077d69d756
47 changed files with 2348 additions and 674 deletions

View File

@@ -18,7 +18,9 @@ cargo run -p server -- server
```
Open <http://127.0.0.1:3000/login> to log in. The admin panel is at
<http://127.0.0.1:3000/admin> and analytics remains at <http://127.0.0.1:3000>.
<http://127.0.0.1:3000/admin>, roles and permissions are at
<http://127.0.0.1:3000/permissions>, and analytics remains at
<http://127.0.0.1:3000>.
The access token is kept in an HTTP-only cookie. The default gRPC endpoint is
`http://[::1]:50051`. Both addresses can be changed:
@@ -70,6 +72,15 @@ src/ templates/
… export.html
login/ login/
mod logic state ui login.html
permissions/ permissions/
common/ tabs.html the section switcher
loader logic state ui
roles/ roles/
mod loader logic state ui roles.html
users/ users/
mod loader logic state ui users.html
grants/ grants/
mod loader logic state ui grants.html
static/app.css the only stylesheet, at /static/app.css
```
@@ -101,6 +112,10 @@ endpoint in a comment on line 1.
| `GET /admin/validation/sets/new` | `pages/add_validation/` | `set.html` |
| `GET /admin/import` | `pages/import_export/import/` | `import.html` |
| `GET /admin/export` | `pages/import_export/export/` | `export.html` |
| `GET /permissions` | `pages/permissions/` | redirect to the first open section |
| `GET /permissions/roles` | `pages/permissions/roles/` | `roles.html` |
| `GET /permissions/users` | `pages/permissions/users/` | `users.html` |
| `GET /permissions/grants` | `pages/permissions/grants/` | `grants.html` |
Every form `POST` answers with `ui/alert_fragment.html`, swapped into the page's
`#submission-status`. Analytics errors use the lighter `ui/notice.html`.
@@ -127,6 +142,36 @@ files include a table-name header row before the column-name row. Browser files
are read locally and submitted to Axum; the backend is accessed only through the
existing `TablesData` gRPC service.
## Permissions
Permissions are a nav section of their own, not a page inside the admin panel:
managing people is a different job from designing tables, and the two are held
by different accounts. The section is three pages, one per decision, with a tab
bar between them:
- **`/permissions/roles`** — which roles exist, what they inherit from, how many
people hold each, and removing the ones nobody holds. Creating a role can hand
it starter access (`Read everything` or `Read and write everything`) in the
same submission.
- **`/permissions/users`** — who holds which role, and password resets. Only
users whose role the caller outranks carry controls.
- **`/permissions/grants`** — what a role may do, as one matrix per profile:
objects down the side, `read / insert / update / delete` across the top. A
cell is a grant held directly (click to revoke), an inherited one (changed on
the parent role), or an empty one (click to grant).
Every button on the grants page — one cell, one row's `All`, a profile's
`Full access`, the page's `Full access to everything` — posts the same form to
`POST /permissions/grants/apply`, and differs only in the list of
`object|action` pairs it carries. The lists are built in Rust, so the server is
never asked to work out what "everything" meant, and the shortcuts grant the
wildcard objects (`data:*`, `data:<profile>/*`, `journal:*`, `ecb:*`), which
keeps them covering profiles and tables created later. `ecb:*` is read-only
everywhere, because the server writes it.
The table-definition workspace still edits one table's grants in place; it posts
to the same endpoint and returns to itself.
## Analytics
The first SQL result column is used for category labels. Bar and line charts use