feat: 角色创建与赋权、文件管理单页多级目录与上传可下载、api上传目录可写卷

Made-with: Cursor
This commit is contained in:
whm
2026-03-18 18:26:08 +08:00
parent 07f55e0139
commit 7a97ba8c66
11 changed files with 586 additions and 80 deletions

View File

@@ -31,8 +31,16 @@ var AllPermissions = []struct {
{PermRolePermission, "角色权限管理"},
}
// RolePermissionsDoc MongoDB 文档:角色 ID -> 权限列表
// RolePermissionsDoc MongoDB 文档:角色 ID -> 名称与权限列表(支持自定义角色)
type RolePermissionsDoc struct {
RoleID int `bson:"role_id" json:"role_id"`
RoleName string `bson:"role_name,omitempty" json:"role_name"`
Permissions []string `bson:"permissions" json:"permissions"`
}
// 预定义角色 ID 的默认名称(未在 DB 中存 role_name 时使用)
var DefaultRoleNames = map[int]string{
RoleIDSuperAdmin: "超级管理员",
RoleIDSuperUser: "超级用户",
RoleIDUser: "普通用户",
}

View File

@@ -56,11 +56,12 @@ type FeatureItem struct {
// SiteAsset 站点功能模块/上传文件
type SiteAsset struct {
ID bson.ObjectID `bson:"_id,omitempty" json:"id"`
SiteID string `bson:"site_id" json:"site_id"`
Name string `bson:"name" json:"name"`
FilePath string `bson:"file_path" json:"file_path"` // 相对路径
Size int64 `bson:"size" json:"size"`
ContentType string `bson:"content_type" json:"content_type"`
CreatedAt string `bson:"created_at" json:"created_at"`
ID bson.ObjectID `bson:"_id,omitempty" json:"id"`
SiteID string `bson:"site_id" json:"site_id"`
Name string `bson:"name" json:"name"`
FilePath string `bson:"file_path" json:"file_path"` // 相对路径,可含多级目录
Size int64 `bson:"size" json:"size"`
ContentType string `bson:"content_type" json:"content_type"`
Downloadable bool `bson:"downloadable" json:"downloadable"` // 是否允许下载
CreatedAt string `bson:"created_at" json:"created_at"`
}