Add additional username checks

This commit is contained in:
zhaojisen
2026-03-23 10:59:34 +08:00
committed by Jiangjie Bai
parent 6ff29ae819
commit 8404f354a3

View File

@@ -6,6 +6,7 @@ import request from '@/utils/request'
import { message } from '@/utils/vue/message'
const getSettings = () => store.state.settings.publicSettings || {}
const currentUser = () => store.getters.currentUser || {}
const Setting = () => import('@/views/settings/index')
const globalSubmenu = () => import('@/layout/globalOrg.vue')
@@ -31,6 +32,11 @@ function goToJDMC(path) {
})
}
function isSystemAdmin() {
const user = currentUser()
return user.username === 'admin'
}
export default {
path: '/settings',
component: Setting,
@@ -590,8 +596,12 @@ export default {
hidden: ({ settings }) => !settings['JDMC_ENABLED']
},
beforeEnter: (_to, _from, next) => {
goToJDMC('/jdmc/')
next(false)
if (isSystemAdmin()) {
goToJDMC('/jdmc/')
next(false)
} else {
next()
}
}
},
{
@@ -600,7 +610,7 @@ export default {
component: () => import('@/views/settings/License'),
beforeEnter: (_to, _from, next) => {
const settings = getSettings()
if (settings?.JDMC_ENABLED) {
if (settings?.JDMC_ENABLED && isSystemAdmin()) {
goToJDMC('/jdmc/app-management/app-auth')
next(false)
} else {
@@ -615,4 +625,3 @@ export default {
}
]
}