feat(app): admin and catalogue entries, step-up guard, MFA in Mon compte (V1-2.5 E, F)
Nav hint from own grants and roles (never a control); RequireCatalog, RequireAdmin (no admin read before aal2), Accès non autorisé page, placeholder routes; TOTP factor list, enrolment with QR and one-time secret, removal, inline step-up for aal2 actions, step-up in password reset; auth kind aal2_required. App 601, e2e:ui 227.
This commit is contained in:
1 parent
99488d71d9
commit
4744e28986
38 files changed
+1818
-55
No files matched your search
@@ -14,6 +14,8 @@ import {
|
||||
downloadAvatar,
|
||||
fetchOwnAvatarState,
|
||||
fetchPersonalWorkspaceId,
|
||||
listOwnCatalogGrants,
|
||||
type OwnCatalogGrant,
|
||||
classifyRecordError,
|
||||
type FaunosteoClient,
|
||||
type RecordFailureKind,
|
||||
@@ -60,6 +62,12 @@ export interface AuthState {
|
||||
/** Blob URL of the clean photo (downloaded under RLS), revoked on change or sign-out. */
|
||||
avatarUrl: string | null
|
||||
workspace: WorkspaceState
|
||||
/**
|
||||
* The account's own catalogue grant rows, for the navigation hint only
|
||||
* (contract §5.3, `navigationHint`): never a control, the server decides.
|
||||
* Empty until loaded and when the read fails.
|
||||
*/
|
||||
catalogGrants: OwnCatalogGrant[]
|
||||
/** Subscribes to the client; returns the unsubscribe. Safe to call twice. */
|
||||
start: () => () => void
|
||||
refreshAccount: () => Promise<void>
|
||||
@@ -141,6 +149,9 @@ async function loadAccount(client: FaunosteoClient, user: User, set: Set, get: G
|
||||
await Promise.all([
|
||||
loadWorkspace(client, user, profile, setOwn, get),
|
||||
syncAvatar(client, user, setOwn, get).catch(() => setOwn({ avatar: null })),
|
||||
listOwnCatalogGrants(client, user.id)
|
||||
.then((catalogGrants) => setOwn({ catalogGrants }))
|
||||
.catch(() => setOwn({ catalogGrants: [] })),
|
||||
])
|
||||
}
|
||||
|
||||
@@ -153,6 +164,7 @@ function accountReset(get: Get): Partial<AuthState> {
|
||||
avatar: null,
|
||||
avatarUrl: null,
|
||||
workspace: { status: 'idle' },
|
||||
catalogGrants: [],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,6 +235,7 @@ export const useAuthStore = create<AuthState>((set, get) => ({
|
||||
avatar: null,
|
||||
avatarUrl: null,
|
||||
workspace: { status: 'idle' },
|
||||
catalogGrants: [],
|
||||
|
||||
start: () => {
|
||||
const client = getSupabaseClient()
|
||||
|
||||
Reference in new issue
Block a user