feat(admin): full session material management in the session editor

See the attached file (clean name), Open (signed-URL preview), Download
(authenticated blob under the original filename), Delete (confirm, storage
object + path, errors surface), and Upload/Replace with previous-object
cleanup and upload rollback on DB failure. Admins already passed every
storage RLS gate for material writes, so no migration; this also documents
and smoke-verifies insert/read/update/delete as an impersonated admin.
Also fixes the stale e2e expectation that the speaker-portal download is an
<a href> (it became an authenticated blob button with the private bucket).
This commit is contained in:
Lago committed 2026-10-21 21:17:02 +02:00
1 parent 246be7d787
commit ca88c0e564
5 files changed
+150 -43

No files matched your search

+3 -1
View File
@@ -149,7 +149,9 @@ timezone('Europe/Amsterdam', now())`). Anything malformed or in another bucket
is denied by this policy (other buckets keep their own policies).
Registered speakers can write only their own non-service session paths; admins
retain material management access. Any authenticated attendee can read (download).
retain material management access (the admin session editor uses these same
policies for its open/download/delete/upload-on-behalf-of-speaker actions).
Any authenticated attendee can read (download).
Because the `sessions` table is admin-write only, a speaker attaches their
uploaded file via the `set_session_material` RPC (see
[rpcs.md](./rpcs.md#set_session_materialp_session_id-p_material_path--sessions)).
+18 -2
View File
@@ -284,8 +284,24 @@ event uses, but the `category` is `admin` so manual adjustments are auditable in
### Session material
The Schedule view uploads a session's material to the `materials` bucket and sets
`sessions.material_path` (admins can write `sessions` directly).
The session editor in the Schedule view manages a session's material in the
private `materials` bucket — admins can act **on behalf of a speaker** at any
time (storage RLS lets `is_admin()` read, insert, update and delete, bypassing
the attendee time-lock):
- **See** — the current file is shown with its clean name (the
`sessions/<id>/<ts>-<name>` timestamp prefix stripped) plus a hint of when
attendees unlock it (slot date + end time).
- **Open** — short-lived signed URL (600 s) in a new tab; previews inline for
browser-renderable types (PDF).
- **Download** — authenticated storage download saved as a blob under the
clean filename.
- **Delete** — confirm dialog, then the storage object is removed (errors
surface rather than orphaning) and `material_path` is nulled.
- **Upload / replace** — file input; on Save the new object uploads
(`upsert`), `sessions.material_path` is updated (admins write `sessions`
directly), the previous object is deleted, and a failed DB update rolls the
fresh upload back. New sessions upload right after creation.
### Feedback AI Summaries