Server load redirects READ_ALL-only users (or unauthenticated) to /documents. Page load: onMount reads bulkSelectionStore — redirects to /documents when the store is empty, otherwise POSTs the IDs to /api/documents/batch-metadata and hands the resulting summaries to BulkDocumentEditLayout in mode="edit". Refs #225 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
11 lines
316 B
TypeScript
11 lines
316 B
TypeScript
import { redirect } from '@sveltejs/kit';
|
|
|
|
export async function load({ locals }: { locals: App.Locals }) {
|
|
const canWrite =
|
|
locals.user?.groups?.some((g: { permissions: string[] }) =>
|
|
g.permissions.includes('WRITE_ALL')
|
|
) ?? false;
|
|
if (!canWrite) throw redirect(303, '/documents');
|
|
return { canWrite };
|
|
}
|