feat: add unique super administrator and role management
This commit is contained in:
1 parent
9e731e47b9
commit
386d15cde2
16 files changed
+455
-24
No files matched your search
@@ -1,4 +1,4 @@
|
||||
export type AuthRole = 'user' | 'admin'
|
||||
export type AuthRole = 'user' | 'admin' | 'super_admin'
|
||||
|
||||
export interface AuthUser {
|
||||
id: string
|
||||
|
||||
@@ -118,7 +118,7 @@ export interface AdminCatalogUser {
|
||||
account: string
|
||||
accountKind: 'email' | 'phone' | 'username'
|
||||
displayName: string
|
||||
role: 'user' | 'admin'
|
||||
role: 'user' | 'admin' | 'super_admin'
|
||||
status: 'active' | 'disabled'
|
||||
createdAt: string
|
||||
lastLoginAt?: string
|
||||
@@ -286,6 +286,12 @@ class HttpCatalogClient {
|
||||
return this.request<{ users: AdminCatalogUser[] }>('/api/admin/users')
|
||||
}
|
||||
|
||||
async changeUserRole(id: string, role: 'user' | 'admin') {
|
||||
return this.request<{ user: AdminCatalogUser }>(`/api/admin/users/${encodeURIComponent(id)}/role`, {
|
||||
method: 'POST', body: JSON.stringify({ role }),
|
||||
})
|
||||
}
|
||||
|
||||
async listAdminAudit(limit = 100) {
|
||||
return this.request<{ events: AdminAuditEvent[] }>(`/api/admin/audit?limit=${limit}`)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user