feat(rbac): add roles and permissions
This commit is contained in:
parent
86a32a942c
commit
694b7bd09a
37 changed files with 2682 additions and 218 deletions
37
frontend/athena/types/rbac.ts
Normal file
37
frontend/athena/types/rbac.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
export type PermissionName = string;
|
||||
|
||||
export interface Permission {
|
||||
id: number;
|
||||
name: PermissionName;
|
||||
display_name: string;
|
||||
description: string;
|
||||
module: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
id: number;
|
||||
name: string;
|
||||
display_name: string;
|
||||
description: string;
|
||||
is_system: boolean;
|
||||
permissions: Permission[];
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface RolePayload {
|
||||
name: string;
|
||||
display_name: string;
|
||||
description: string;
|
||||
permission_ids: number[];
|
||||
}
|
||||
|
||||
export interface CurrentUser {
|
||||
id: number;
|
||||
username: string;
|
||||
email: string;
|
||||
role: string;
|
||||
permissions: PermissionName[];
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
export type UserRole = "admin" | "manager" | "user";
|
||||
import type { Role } from "@/types/rbac";
|
||||
|
||||
export type UserRole = string;
|
||||
|
||||
export interface User {
|
||||
id: number;
|
||||
|
|
@ -7,6 +9,8 @@ export interface User {
|
|||
username: string;
|
||||
email: string;
|
||||
role: UserRole;
|
||||
role_id: number;
|
||||
primary_role: Role;
|
||||
is_active: boolean;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
|
|
@ -18,6 +22,7 @@ export type UserPayload = {
|
|||
username: string;
|
||||
email: string;
|
||||
role: UserRole;
|
||||
role_id?: number;
|
||||
is_active: boolean;
|
||||
password?: string;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue