Restrict menu visibility for non-System Users
This commit is contained in:
parent
1811c3fe2f
commit
329a5d1c5c
@ -176,9 +176,26 @@ export const useMenuStore = defineStore('menu', () => {
|
|||||||
// 过滤隐藏的菜单项
|
// 过滤隐藏的菜单项
|
||||||
if (m.hidden) return false
|
if (m.hidden) return false
|
||||||
|
|
||||||
// 非 System User 过滤掉 pagetype 和 workspace 类型
|
// 非 System User 的过滤逻辑
|
||||||
if (!isSystemUser && (m.type === 'pagetype' || m.type === 'workspace')) {
|
if (!isSystemUser) {
|
||||||
return false
|
// 过滤掉 pagetype 和 workspace 类型
|
||||||
|
if (m.type === 'pagetype' || m.type === 'workspace') {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只允许显示的根菜单:工具、开发、菜单管理、设置
|
||||||
|
const allowedRootMenus = ['tools', 'dev-group', 'menuManager', 'settings']
|
||||||
|
if (!m.parentId && !allowedRootMenus.includes(m.id)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开发分组下只允许显示:应用市场、节点市场、智能体市场
|
||||||
|
if (m.parentId === 'dev-group') {
|
||||||
|
const allowedDevMenus = ['app-marketplace', 'node-marketplace', 'agent-marketplace']
|
||||||
|
if (!allowedDevMenus.includes(m.id)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|||||||
@ -164,10 +164,31 @@ const filteredItems = computed(() => {
|
|||||||
const isSystemUser = userType === 'System User'
|
const isSystemUser = userType === 'System User'
|
||||||
|
|
||||||
return menuStore.items.filter(m => {
|
return menuStore.items.filter(m => {
|
||||||
// 非 System User 过滤掉 pagetype 和 workspace 类型
|
// 过滤隐藏的菜单项
|
||||||
if (!isSystemUser && (m.type === 'pagetype' || m.type === 'workspace')) {
|
if (m.hidden) return false
|
||||||
return false
|
|
||||||
|
// 非 System User 的过滤逻辑
|
||||||
|
if (!isSystemUser) {
|
||||||
|
// 过滤掉 pagetype 和 workspace 类型
|
||||||
|
if (m.type === 'pagetype' || m.type === 'workspace') {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只允许显示的根菜单:工具、开发、菜单管理、设置
|
||||||
|
const allowedRootMenus = ['tools', 'dev-group', 'menuManager', 'settings']
|
||||||
|
if (!m.parentId && !allowedRootMenus.includes(m.id)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开发分组下只允许显示:应用市场、节点市场、智能体市场
|
||||||
|
if (m.parentId === 'dev-group') {
|
||||||
|
const allowedDevMenus = ['app-marketplace', 'node-marketplace', 'agent-marketplace']
|
||||||
|
if (!allowedDevMenus.includes(m.id)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user