feat: roles SPA foundations
This commit is contained in:
1 parent
80f7037d3a
commit
907949aa12
180 files changed
+4308
-835
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { useApi } from '@/composables/useApi'
|
||||
import type { LinkableUser } from '@/lib/directoryTypes'
|
||||
import type { RoleRef } from '@/lib/permissions'
|
||||
|
||||
export type UserListItem =
|
||||
| {
|
||||
@@ -8,7 +9,7 @@ export type UserListItem =
|
||||
username: string
|
||||
display_name: string
|
||||
email: string
|
||||
role: 'owner' | 'admin'
|
||||
role: RoleRef | null
|
||||
status: 'accepted'
|
||||
created_at: string
|
||||
}
|
||||
@@ -17,6 +18,7 @@ export type UserListItem =
|
||||
id: number
|
||||
email: string
|
||||
display_name?: string
|
||||
role?: RoleRef | null
|
||||
status: 'pending' | 'expired'
|
||||
created_at: string
|
||||
}
|
||||
@@ -31,14 +33,15 @@ export function userDisplayName(item: UserListItem) {
|
||||
return item.display_name ?? ''
|
||||
}
|
||||
|
||||
export function userRole(item: UserListItem): 'owner' | 'admin' {
|
||||
return item.kind === 'user' ? item.role : 'admin'
|
||||
export function userRole(item: UserListItem): RoleRef | null {
|
||||
return item.role ?? null
|
||||
}
|
||||
|
||||
export interface CreatedInvite {
|
||||
id: number
|
||||
kind: 'invite'
|
||||
email: string
|
||||
role?: RoleRef | null
|
||||
status: 'pending'
|
||||
created_at: string
|
||||
expires_at: string
|
||||
|
||||
Reference in new issue
Block a user