mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-25 14:25:23 +00:00
feat: 修改角色切换
This commit is contained in:
@@ -50,7 +50,7 @@ export default {
|
||||
'currentOrgPerms'
|
||||
]),
|
||||
isInAdminRole() {
|
||||
const inAdmin = (this.currentRole & this.adminPageRequirePerm) !== 0
|
||||
const inAdmin = rolec.hasPerm(rolec.ADMIN_PAGE_REQUIRE_PERM_MIN, this.currentRole)
|
||||
return inAdmin
|
||||
},
|
||||
hasAdminOrg() {
|
||||
@@ -59,9 +59,9 @@ export default {
|
||||
adminPageRequirePerm() {
|
||||
return rolec.PERM_SUPER | rolec.PERM_ADMIN | rolec.PERM_AUDIT
|
||||
},
|
||||
currentOrgAdminPagePerm() {
|
||||
hasCurrentOrgAdminPagePerm() {
|
||||
// 只有有一个权限就可以
|
||||
return this.adminPageRequirePerm & this.currentOrgPerms
|
||||
return rolec.hasAdminPagePerm(this.currentOrgPerms)
|
||||
},
|
||||
currentOrgUsePagePerm() {
|
||||
const userPageRequireRole = rolec.PERM_USE
|
||||
@@ -75,8 +75,9 @@ export default {
|
||||
this.$router.push({ name: 'UserProfile' })
|
||||
break
|
||||
case 'adminPage':
|
||||
this.$store.dispatch('users/setCurrentRole', this.currentOrgAdminPagePerm)
|
||||
if (this.currentOrgAdminPagePerm) {
|
||||
if (this.hasCurrentOrgAdminPagePerm) {
|
||||
const currentRole = rolec.getUserInAdminPagePerm(this.currentOrgPerms)
|
||||
this.$store.dispatch('users/setCurrentRole', currentRole)
|
||||
window.location.href = `/ui/`
|
||||
} else {
|
||||
orgUtil.change2PropOrg()
|
||||
|
@@ -152,17 +152,18 @@ export const allRoleRoutes = [
|
||||
},
|
||||
...requireContext.keys().map(key => requireContext(key).default),
|
||||
{
|
||||
name: 'Settings',
|
||||
path: '/settings',
|
||||
component: Layout,
|
||||
redirect: '/settings/',
|
||||
permissions: [rolec.PERM_SUPER],
|
||||
children: [{
|
||||
path: 'settings',
|
||||
name: 'Settings',
|
||||
component: () => import('@/views/settings/index'),
|
||||
meta: { title: i18n.t('route.Settings'), icon: 'gears', permissions: [rolec.PERM_SUPER] }
|
||||
}]
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
name: 'Settings',
|
||||
component: () => import('@/views/settings/index'),
|
||||
meta: { title: i18n.t('route.Settings'), icon: 'gears', permissions: [rolec.PERM_SUPER] }
|
||||
}
|
||||
]
|
||||
},
|
||||
...userPageRoutes,
|
||||
{ path: '*', redirect: '/404', hidden: true, meta: { roles: ['SuperAdmin', 'Admin', 'Auditor', 'User'] }}
|
||||
|
@@ -25,7 +25,7 @@ export default {
|
||||
{
|
||||
path: '',
|
||||
component: () => import('@/views/xpack/GatheredUser/index'),
|
||||
name: 'GatherUserList',
|
||||
name: 'GatherUserListIndex',
|
||||
meta: { title: i18n.t('xpack.GatherUser.GatherUser'), activeMenu: '/xpack/gathered-users' }
|
||||
},
|
||||
{
|
||||
@@ -61,9 +61,8 @@ export default {
|
||||
{
|
||||
path: 'orgs',
|
||||
component: empty,
|
||||
name: 'OrganizationList',
|
||||
redirect: '',
|
||||
meta: { title: i18n.t('xpack.Organization.OrganizationList'), permissions: [rolec.PERM_SUPER] },
|
||||
meta: { permissions: [rolec.PERM_SUPER] },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
@@ -159,7 +158,6 @@ export default {
|
||||
path: 'cloud',
|
||||
component: empty,
|
||||
redirect: '',
|
||||
name: 'Cloud',
|
||||
meta: { title: i18n.t('xpack.Cloud.Cloud') },
|
||||
children: [
|
||||
{
|
||||
|
Reference in New Issue
Block a user