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
@@ -28,6 +28,7 @@ const INITIAL = {
|
||||
avatar: null,
|
||||
avatarUrl: null,
|
||||
workspace: { status: 'idle' as const },
|
||||
catalogGrants: [],
|
||||
}
|
||||
|
||||
let fake: FakeSupabase
|
||||
@@ -94,6 +95,24 @@ describe('authStore', () => {
|
||||
expect(useAuthStore.getState().urlFailure).toBe('link_expired')
|
||||
})
|
||||
|
||||
it('loads the own grant rows for the navigation hint and drops them on a change of account', async () => {
|
||||
const grant = { user_id: 'user-1', kind: 'catalog_reader', expires_at: null, revoked_at: null }
|
||||
fake.tables.anatomical_catalog_grants = [grant]
|
||||
fake.tables.profiles = [fakeProfile(), fakeProfile({ id: 'user-2' })]
|
||||
stop = useAuthStore.getState().start()
|
||||
fake.emit('SIGNED_IN', fakeSession())
|
||||
await flush()
|
||||
await flush()
|
||||
expect(useAuthStore.getState().catalogGrants).toEqual([grant])
|
||||
fake.emit('SIGNED_IN', fakeSession(fakeUser({ id: 'user-2' })))
|
||||
expect(useAuthStore.getState().catalogGrants).toEqual([])
|
||||
await flush()
|
||||
await flush()
|
||||
expect(useAuthStore.getState().catalogGrants).toEqual([])
|
||||
fake.emit('SIGNED_OUT', null)
|
||||
expect(useAuthStore.getState().catalogGrants).toEqual([])
|
||||
})
|
||||
|
||||
it('updateProfile writes the row and keeps the store in sync', async () => {
|
||||
stop = useAuthStore.getState().start()
|
||||
fake.emit('SIGNED_IN', fakeSession())
|
||||
|
||||
Reference in new issue
Block a user