- Derives canBlogWrite in +layout.server.ts the same way as canAnnotate. - Adds Geschichten link to AppNav (desktop + mobile, between Stammbaum and Admin). - Adds error_geschichte_not_found mapping to errors.ts and translation keys for the Geschichten index, detail, editor, and confirmation copy in de/en/es. - Adds isomorphic-dompurify-backed safeHtml() helper with allow-list matching the backend OWASP policy (p/br/strong/em/h2/h3/ul/ol/li), plus Vitest spec. - Updates legacy spec test data so the new required canBlogWrite layout prop type-checks. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
14 lines
486 B
TypeScript
14 lines
486 B
TypeScript
import type { LayoutServerLoad } from './$types';
|
|
|
|
export const load: LayoutServerLoad = async ({ locals }) => {
|
|
const groups: { permissions: string[] }[] = locals.user?.groups ?? [];
|
|
return {
|
|
user: locals.user,
|
|
canWrite: groups.some((g) => g.permissions.includes('WRITE_ALL')),
|
|
canAnnotate: groups.some(
|
|
(g) => g.permissions.includes('WRITE_ALL') || g.permissions.includes('ANNOTATE_ALL')
|
|
),
|
|
canBlogWrite: groups.some((g) => g.permissions.includes('BLOG_WRITE'))
|
|
};
|
|
};
|