fix(ui): hide write/edit controls from READ_ALL (read-only) users (#696) #699
@@ -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()}
|
||||
|
||||
@@ -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 ─────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user