feat(sessions): material downloads unlock when the session ends

Private materials bucket + RLS read gate (admins/own speakers anytime, all
attendees after the scheduled slot end, event-local Amsterdam time); always
visible uploaded-state, locked download panel, authenticated client downloads,
admin signed URLs. 12 new assertions in material_time_lock_tests.sql.

Co-authored-by: Stephan Charles <[email protected]>
Co-authored-by: Amelia Hernandez <[email protected]>
Co-authored-by: Markus Franz <[email protected]>
Co-authored-by: Sabrina Hota <[email protected]>
Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
committed 2026-10-21 18:57:15 +02:00
1 parent 7776145a77
commit a8f3f5b8e1
13 files changed
+334 -30

No files matched your search

+6 -3
View File
@@ -538,9 +538,12 @@ export async function removeSessionMaterial(sessionId: string): Promise<void> {
if (error) throw new ApiError(error.message);
}
export function sessionMaterialUrl(path: string): string {
const { data } = supabase.storage.from('materials').getPublicUrl(path);
return data.publicUrl;
/** Open a session material in a new tab via a short-lived signed URL. The
* materials bucket is private; storage RLS always allows admins. */
export async function openSessionMaterial(path: string): Promise<void> {
const { data, error } = await supabase.storage.from('materials').createSignedUrl(path, 600);
if (error) throw new ApiError(error.message);
window.open(data.signedUrl, '_blank');
}
async function feedbackSidecarFetch<T>(path: string, init?: RequestInit): Promise<T> {
+13 -3
View File
@@ -8,7 +8,7 @@ import {
getSessions,
getSlots,
removeSessionMaterial,
sessionMaterialUrl,
openSessionMaterial,
setSessionSpeakers,
uploadSessionMaterial,
} from '../lib/api';
@@ -573,9 +573,19 @@ function SessionModal({
<label>Material</label>
{session.material_path ? (
<div className="row" style={{ gap: 10 }}>
<a className="btn small" href={sessionMaterialUrl(session.material_path)} target="_blank" rel="noreferrer">
<button
className="btn small"
disabled={busy}
onClick={async () => {
try {
await openSessionMaterial(session.material_path!);
} catch (e) {
onSaved(e instanceof Error ? e.message : 'Could not open material');
}
}}
>
📎 View current
</a>
</button>
<button
className="btn small danger"
disabled={busy}