fix(ui): hide write/edit controls from READ_ALL (read-only) users (#696) #699

Merged
marcel merged 4 commits from feat/issue-696-hide-write-controls into main 2026-05-31 11:31:35 +02:00
2 changed files with 8 additions and 1 deletions
Showing only changes of commit c3652f5b57 - Show all commits

View File

@@ -75,7 +75,7 @@ const userInitials = $derived.by(() => {
<!-- Right Side -->
<div class="flex items-center gap-3">
{#if data?.user}
{#if data?.user && data.canWrite}
<a
href="/documents/new"
aria-label={m.upload_action()}

View File

@@ -83,6 +83,13 @@ describe('Layout upload link', () => {
const link = page.getByRole('link', { name: /Hochladen|Upload|Subir/i });
await expect.element(link).toHaveAttribute('href', '/documents/new');
});
it('is hidden for a user without WRITE_ALL', async () => {
render(Layout, { data: makeData({ canWrite: false }), children: emptySnippet });
await expect
.element(page.getByRole('link', { name: /Hochladen|Upload|Subir/i }))
.not.toBeInTheDocument();
});
});
// ─── Dropdown ─────────────────────────────────────────────────────────────────