fix: 权限列表JSON字段与角色可编辑; 前台site_id与SPA; 首页积木扩展区
Made-with: Cursor
This commit is contained in:
@@ -122,7 +122,8 @@ func UpdateRolePermissions(c *gin.Context) {
|
||||
coll := config.GetDB(config.DBName).Collection("role_permissions")
|
||||
filter := bson.M{"role_id": roleID}
|
||||
set := bson.M{"role_id": roleID, "permissions": input.Permissions}
|
||||
if input.RoleName != "" && roleID >= customRoleIDStart {
|
||||
// 超级管理员(9527)已拦截;其余预定义(0/1)与自定义角色均可更新显示名称
|
||||
if input.RoleName != "" {
|
||||
set["role_name"] = input.RoleName
|
||||
}
|
||||
update := bson.M{"$set": set}
|
||||
|
||||
@@ -14,21 +14,24 @@ const (
|
||||
PermRolePermission = "role:permission" // 角色权限管理
|
||||
)
|
||||
|
||||
// PermissionItem 单条权限定义(JSON 须用小写 key/name,供前端展示与勾选)
|
||||
type PermissionItem struct {
|
||||
Key string `json:"key"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// AllPermissions 所有可配置权限(用于角色权限管理页)
|
||||
var AllPermissions = []struct {
|
||||
Key string
|
||||
Name string
|
||||
}{
|
||||
{PermSiteManage, "站点管理"},
|
||||
{PermHomepageEdit, "首页编辑"},
|
||||
{PermPageManage, "网页管理"},
|
||||
{PermModuleUpload, "功能模块上传"},
|
||||
{PermUserManage, "用户管理"},
|
||||
{PermWorkspaceManage, "工作空间"},
|
||||
{PermConversationManage, "对话管理"},
|
||||
{PermSMSConfig, "短信配置"},
|
||||
{PermPaymentConfig, "支付配置"},
|
||||
{PermRolePermission, "角色权限管理"},
|
||||
var AllPermissions = []PermissionItem{
|
||||
{Key: PermSiteManage, Name: "站点管理"},
|
||||
{Key: PermHomepageEdit, Name: "首页编辑"},
|
||||
{Key: PermPageManage, Name: "网页管理"},
|
||||
{Key: PermModuleUpload, Name: "功能模块上传"},
|
||||
{Key: PermUserManage, Name: "用户管理"},
|
||||
{Key: PermWorkspaceManage, Name: "工作空间"},
|
||||
{Key: PermConversationManage, Name: "对话管理"},
|
||||
{Key: PermSMSConfig, Name: "短信配置"},
|
||||
{Key: PermPaymentConfig, Name: "支付配置"},
|
||||
{Key: PermRolePermission, Name: "角色权限管理"},
|
||||
}
|
||||
|
||||
// RolePermissionsDoc MongoDB 文档:角色 ID -> 名称与权限列表(支持自定义角色)
|
||||
|
||||
@@ -40,6 +40,8 @@ type HomepageData struct {
|
||||
BadgeText string `json:"badge_text"` // FREE ACCESS
|
||||
Features []FeatureItem `json:"features"` // 星际导航等
|
||||
FooterText string `json:"footer_text"` // © 2024 YUHENG ONE
|
||||
// BodyBuilder 首页下方扩展区:与网页积木相同 JSON 字符串 {"version":1,"blocks":[...]},空则仅展示上方模板
|
||||
BodyBuilder string `json:"body_builder,omitempty"`
|
||||
}
|
||||
|
||||
type NavLink struct {
|
||||
|
||||
Reference in New Issue
Block a user