feat: roles SPA foundations
This commit is contained in:
1 parent
80f7037d3a
commit
907949aa12
180 files changed
+4308
-835
No files matched your search
@@ -12,6 +12,8 @@ import { useSessionStore } from '@/stores/session'
|
||||
import { DESKTOP_WIDTH, setViewportWidth } from '@/components/__tests__/viewport'
|
||||
import AuthorsView from '../AuthorsView.vue'
|
||||
import SitesView from '../SitesView.vue'
|
||||
import { accessFor, ownerAccess, roleRefFor } from '@/test/access'
|
||||
import type { Access } from '@/lib/permissions'
|
||||
|
||||
export interface Call {
|
||||
method: string
|
||||
@@ -155,7 +157,7 @@ export function usersFixture() {
|
||||
username,
|
||||
display_name: display,
|
||||
email,
|
||||
role,
|
||||
role: roleRefFor(role),
|
||||
status: 'accepted',
|
||||
created_at: '2026-03-12T09:00:00Z',
|
||||
})
|
||||
@@ -329,6 +331,7 @@ export function pending<T>() {
|
||||
|
||||
export interface MountOptions {
|
||||
role?: string
|
||||
access?: Access
|
||||
width?: number
|
||||
backend?: Backend
|
||||
author?: MeAuthor
|
||||
@@ -357,7 +360,7 @@ export async function mountDirectory(
|
||||
id: 1,
|
||||
email: options.email ?? 'marta@renew.example',
|
||||
displayName: 'Marta Alves',
|
||||
role: (options.role ?? 'owner') as never,
|
||||
access: options.access ?? accessFor(options.role ?? 'owner'),
|
||||
...(options.author ? { author: options.author } : {}),
|
||||
}
|
||||
session.status = 'ready'
|
||||
@@ -387,7 +390,9 @@ export async function mountDirectory(
|
||||
return { body: result, total: (result as { total: number }).total }
|
||||
})
|
||||
vi.mocked(useApi).mockReturnValue({
|
||||
getMe: vi.fn().mockResolvedValue({ verified: true, username: 'marta', id: 1 }),
|
||||
getMe: vi
|
||||
.fn()
|
||||
.mockResolvedValue({ verified: true, access: ownerAccess(), username: 'marta', id: 1 }),
|
||||
request,
|
||||
requestPaged,
|
||||
} as unknown as ReturnType<typeof useApi>)
|
||||
|
||||
Reference in new issue
Block a user