This commit is contained in:
2026-07-18 10:52:32 +08:00
parent 2dcafae465
commit b5ef58f434
61 changed files with 1274 additions and 2142 deletions

View File

@@ -5,7 +5,7 @@ import "time"
// Role 角色模型
// RBAC核心: 用户 -> 角色 -> 权限
type Role struct {
ID uint64 `json:"id" gorm:"primaryKey;autoIncrement"`
ID uint64 `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"uniqueIndex;size:64;not null"` // 角色标识: admin/editor/viewer
DisplayName string `json:"display_name" gorm:"size:64;not null"` // 显示名称: 管理员/编辑者/查看者
Description string `json:"description" gorm:"size:256"` // 角色描述
@@ -25,7 +25,7 @@ func (Role) TableName() string {
// Permission 权限模型
// 定义系统中所有可控制的操作权限
type Permission struct {
ID uint64 `json:"id" gorm:"primaryKey;autoIncrement"`
ID uint64 `json:"id" gorm:"primaryKey"`
Code string `json:"code" gorm:"uniqueIndex;size:64;not null"` // 权限标识: file:upload, file:delete, user:manage
Name string `json:"name" gorm:"size:64;not null"` // 显示名称: 上传文件, 删除文件, 用户管理
Resource string `json:"resource" gorm:"size:32;not null"` // 资源类型: file, folder, share, user, system