fix(app): unreadable permissions show a retry, never the form (V1-2.5 L1)
Owner checkpoint 2026-11-02: creation page checks loading, server refusal, failed read, then the editor rule; Administration home shows the same notice. reloadAccess re-reads roles and grants without wiping held state; refreshAccount (no caller) removed. Zone panel live region always mounted. Unit and e2e for reviewer-only and editor.
This commit is contained in:
1 parent
14ff890761
commit
4111efa1d1
15 files changed
+856
-56
No files matched your search
@@ -96,36 +96,38 @@ export default function ZonePanel({ state, viewId, selectedId, onSelect }: ZoneP
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
{annotation ? (
|
||||
<div aria-live="polite" className="space-y-2">
|
||||
<h2 id="catalogue-zone-title" className="font-serif text-lg text-[var(--color-ink)]">
|
||||
{t('catalogue.zone.title').replace('{name}', nameOf(annotation.id))}
|
||||
</h2>
|
||||
<p className="text-sm text-[var(--color-ink-muted)]">
|
||||
{zoneLine(state, annotation, locale, t)}
|
||||
<div aria-live="polite" className="space-y-2">
|
||||
{annotation ? (
|
||||
<>
|
||||
<h2 id="catalogue-zone-title" className="font-serif text-lg text-[var(--color-ink)]">
|
||||
{t('catalogue.zone.title').replace('{name}', nameOf(annotation.id))}
|
||||
</h2>
|
||||
<p className="text-sm text-[var(--color-ink-muted)]">
|
||||
{zoneLine(state, annotation, locale, t)}
|
||||
</p>
|
||||
{findingZone && findingZone.categories.length > 0 ? (
|
||||
findingZone.categories.map((category) => (
|
||||
<section key={category.id} className="space-y-1 pt-1">
|
||||
<h3 className="text-xs font-semibold uppercase tracking-wide text-[var(--color-ink-muted)]">
|
||||
{pickLabel(category.name, locale)}
|
||||
</h3>
|
||||
<ul className="divide-y divide-[var(--color-border)]">
|
||||
{category.children.map((node) => (
|
||||
<FindingItem key={node.id} node={node} locale={locale} />
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
))
|
||||
) : (
|
||||
<p className="text-sm text-[var(--color-ink-muted)]">{t('catalogue.zone.no_findings')}</p>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<p id="catalogue-zone-title" className="text-sm text-[var(--color-ink-muted)]">
|
||||
{t('catalogue.zone.prompt')}
|
||||
</p>
|
||||
{findingZone && findingZone.categories.length > 0 ? (
|
||||
findingZone.categories.map((category) => (
|
||||
<section key={category.id} className="space-y-1 pt-1">
|
||||
<h3 className="text-xs font-semibold uppercase tracking-wide text-[var(--color-ink-muted)]">
|
||||
{pickLabel(category.name, locale)}
|
||||
</h3>
|
||||
<ul className="divide-y divide-[var(--color-border)]">
|
||||
{category.children.map((node) => (
|
||||
<FindingItem key={node.id} node={node} locale={locale} />
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
))
|
||||
) : (
|
||||
<p className="text-sm text-[var(--color-ink-muted)]">{t('catalogue.zone.no_findings')}</p>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<p id="catalogue-zone-title" className="text-sm text-[var(--color-ink-muted)]">
|
||||
{t('catalogue.zone.prompt')}
|
||||
</p>
|
||||
)}
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
@@ -7,9 +7,10 @@ import { useT } from '@/i18n/useT'
|
||||
* « Accès non autorisé » (contract §5.3, BDR-094): what a catalogue or
|
||||
* administration page shows when the server refuses (`rights.*`, and
|
||||
* `not_found` under /app/anatomy), the same whether the sheet exists or not;
|
||||
* also the sheet creation page for an account whose own grants hold no editor
|
||||
* capability (a display rule, the server still decides). Nothing from the
|
||||
* address is echoed.
|
||||
* also the sheet creation page once the own grants are read and hold no
|
||||
* editor capability (a display rule, the server still decides). Never shown
|
||||
* for a failed read (PermissionsUnavailable). Nothing from the address is
|
||||
* echoed.
|
||||
*/
|
||||
export default function AccessDenied() {
|
||||
const t = useT()
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import Button from '@/components/ui/Button'
|
||||
import Card from '@/components/ui/Card'
|
||||
import { usePageHeading } from '@/app/usePageHeading'
|
||||
import { useAuthStore } from '@/state/authStore'
|
||||
import { useT } from '@/i18n/useT'
|
||||
|
||||
interface Props {
|
||||
/** The whole page (h1, focused on open) or a section inside one (h2). */
|
||||
asPage: boolean
|
||||
onRetry?: () => void
|
||||
}
|
||||
|
||||
/**
|
||||
* « Impossible de vérifier vos autorisations » (owner 2026-11-02): the own
|
||||
* grants could not be read. A technical error never reads as an absence of
|
||||
* right, so no form and no refusal; Retry reads them again. The server still
|
||||
* decides every action.
|
||||
*/
|
||||
export default function PermissionsUnavailable({ asPage, onRetry }: Props) {
|
||||
const t = useT()
|
||||
const heading = usePageHeading()
|
||||
const retry = onRetry ?? (() => void useAuthStore.getState().reloadAccess())
|
||||
const body = (
|
||||
<>
|
||||
<p className="text-sm text-[var(--color-ink-muted)]">
|
||||
{t('permissions_unavailable.body')}
|
||||
</p>
|
||||
<Button type="button" variant="secondary" onClick={retry}>
|
||||
{t('common.retry')}
|
||||
</Button>
|
||||
</>
|
||||
)
|
||||
if (asPage)
|
||||
return (
|
||||
<Card as="section" className="space-y-3 p-5 sm:p-6">
|
||||
<h1 ref={heading} tabIndex={-1} className="outline-none font-serif text-2xl text-[var(--color-ink)]">
|
||||
{t('permissions_unavailable.title')}
|
||||
</h1>
|
||||
{body}
|
||||
</Card>
|
||||
)
|
||||
return (
|
||||
<Card as="section" aria-labelledby="permissions-unavailable-title" className="space-y-3 p-5 sm:p-6">
|
||||
<h2 id="permissions-unavailable-title" className="font-serif text-lg text-[var(--color-ink)]">
|
||||
{t('permissions_unavailable.title')}
|
||||
</h2>
|
||||
{body}
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user