feat(rbac): add roles and permissions

This commit is contained in:
Schubert Ferenc 2026-07-02 23:05:59 +02:00
parent 86a32a942c
commit 694b7bd09a
37 changed files with 2682 additions and 218 deletions

View 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[];
}

View file

@ -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;
};