批量优化
This commit is contained in:
1 parent
438145cae7
commit
c925b198d1
50 files changed
+5716
-291
No files matched your search
@@ -551,6 +551,26 @@ func ownerModuleCode(sortedModules []models.SystemModules, path string) (string,
|
||||
return "", false
|
||||
}
|
||||
|
||||
// ModuleCodesOwningMenus 返回这些菜单路径归属的模块编码集合(按模块 path 前缀匹配)。
|
||||
// 供角色权限过滤使用:模块名下有菜单但一个都不在授权集合时,模块应整体隐藏。
|
||||
func ModuleCodesOwningMenus(allModules []models.SystemModules, menus []models.SystemMenu) map[string]bool {
|
||||
codes := map[string]bool{}
|
||||
if len(allModules) == 0 || len(menus) == 0 {
|
||||
return codes
|
||||
}
|
||||
sorted := sortModulesByPathDesc(allModules)
|
||||
for _, m := range menus {
|
||||
path := ""
|
||||
if m.Path != nil {
|
||||
path = *m.Path
|
||||
}
|
||||
if code, ok := ownerModuleCode(sorted, path); ok {
|
||||
codes[NormalizeModuleCode(code)] = true
|
||||
}
|
||||
}
|
||||
return codes
|
||||
}
|
||||
|
||||
// FilterMenusByTenantModules 按租户套餐包含的功能模块过滤菜单:
|
||||
// - 菜单不属于任何模块(公共/基础菜单)→ 保留;
|
||||
// - 菜单归属某模块 → 仅当该模块已被租户套餐开通时保留。
|
||||
|
||||
Reference in new issue
Block a user