perf: 移动 Acl 到 perms

This commit is contained in:
Bai
2022-11-30 15:09:31 +08:00
parent 4281e02f95
commit d18cd3d254
7 changed files with 56 additions and 74 deletions

View File

@@ -17,6 +17,7 @@
"date_created": "Date created",
"created_by": "Created by",
"host": "Asset",
"account": "Account",
"system_user": "System user",
"username_group": "Username group",
"hostname_group": "Hostname group",

View File

@@ -20,6 +20,7 @@
"date_created": "時間の作成",
"created_by": "作成者",
"host": "資産情報",
"account": "アカウント情報",
"users": "ユーザー",
"system_user": "システムユーザー",
"username_group": "ユーザー名",

View File

@@ -20,6 +20,7 @@
"date_created": "创建时间",
"created_by": "创建者",
"host": "资产信息",
"account": "账号信息",
"users": "用户",
"system_user": "系统用户",
"username_group": "用户名",

View File

@@ -1,44 +0,0 @@
import i18n from '@/i18n/i18n'
import empty from '@/layout/empty'
export default [
{
path: 'host-acl',
component: empty,
redirect: '',
meta: {
title: i18n.t('route.AssetAclList'),
licenseRequired: true,
resource: 'loginassetacl'
},
children: [
{
path: '',
name: 'AssetAclList',
component: () => import('@/views/acl/AssetAcl/AssetAclList'),
meta: { title: i18n.t('route.AssetAclList') }
},
{
path: 'create',
name: 'AssetAclCreate',
component: () => import('@/views/acl/AssetAcl/AssetAclCreateUpdate'),
hidden: true,
meta: { title: i18n.t('route.AssetAclCreate') }
},
{
path: ':id',
name: 'AssetAclDetail',
component: () => import('@/views/acl/AssetAcl/AssetAclDetail'),
hidden: true,
meta: { title: i18n.t('route.AssetAclDetail') }
},
{
path: ':id/update',
name: 'AssetAclUpdate',
component: () => import('@/views/acl/AssetAcl/AssetAclCreateUpdate'),
hidden: true,
meta: { title: i18n.t('route.AssetAclUpdate') }
}
]
}
]

View File

@@ -7,7 +7,6 @@ import UsersRoute from './users'
import AssetsRoute from './assets'
import PermsRoute from './perms'
import TaskRoutes from './tasks'
import AclRoutes from './acls'
import AccountRoutes from './accounts'
export default {
@@ -76,17 +75,6 @@ export default {
},
children: PermsRoute
},
{
path: '/console/acls',
component: empty,
name: 'Acl',
meta: {
licenseRequired: true,
title: i18n.t('route.Acl'),
icon: 'lock'
},
children: AclRoutes
},
{
path: '/console/tasks',
component: empty,

View File

@@ -38,5 +38,45 @@ export default [
meta: { title: i18n.t('route.AssetPermissionDetail') }
}
]
},
{
path: 'host-acls',
component: empty,
redirect: '',
meta: {
title: i18n.t('route.AssetAclList'),
licenseRequired: true,
app: 'acls',
resource: 'loginassetacl'
},
children: [
{
path: '',
name: 'AssetAclList',
component: () => import('@/views/acl/AssetAcl/AssetAclList'),
meta: { title: i18n.t('route.AssetAclList') }
},
{
path: 'create',
name: 'AssetAclCreate',
component: () => import('@/views/acl/AssetAcl/AssetAclCreateUpdate'),
hidden: true,
meta: { title: i18n.t('route.AssetAclCreate') }
},
{
path: ':id',
name: 'AssetAclDetail',
component: () => import('@/views/acl/AssetAcl/AssetAclDetail'),
hidden: true,
meta: { title: i18n.t('route.AssetAclDetail') }
},
{
path: ':id/update',
name: 'AssetAclUpdate',
component: () => import('@/views/acl/AssetAcl/AssetAclCreateUpdate'),
hidden: true,
meta: { title: i18n.t('route.AssetAclUpdate') }
}
]
}
]

View File

@@ -14,24 +14,23 @@ export default {
return {
initial: {
action: 'login_confirm',
system_users: {
name_group: '*',
protocol_group: '*',
username_group: '*'
},
users: {
username_group: '*'
},
assets: {
hostname_group: '*',
ip_group: '*'
},
accounts: {
name_group: '*',
username_group: '*'
}
},
fields: [
[this.$t('common.Basic'), ['name', 'priority']],
[this.$t('acl.users'), ['users']],
[this.$t('acl.host'), ['assets']],
[this.$t('acl.system_user'), ['system_users']],
[this.$t('acl.account'), ['accounts']],
[this.$t('acl.action'), ['action', 'reviewers']],
[this.$t('common.Other'), ['is_active', 'comment']]
],
@@ -48,8 +47,8 @@ export default {
}
},
system_users: {
fields: ['name_group', 'username_group', 'protocol_group']
accounts: {
fields: ['name_group', 'username_group']
},
reviewers: {
el: {
@@ -67,9 +66,8 @@ export default {
afterGetFormValue(formValue) {
formValue.assets.ip_group = formValue.assets.ip_group.toString()
formValue.assets.hostname_group = formValue.assets.hostname_group.toString()
formValue.system_users.name_group = formValue.system_users.name_group.toString()
formValue.system_users.protocol_group = formValue.system_users.protocol_group.toString()
formValue.system_users.username_group = formValue.system_users.username_group.toString()
formValue.accounts.name_group = formValue.accounts.name_group.toString()
formValue.accounts.username_group = formValue.accounts.username_group.toString()
formValue.users.username_group = formValue.users.username_group.toString()
return formValue
},
@@ -80,14 +78,11 @@ export default {
if (!Array.isArray(value.assets.hostname_group)) {
value.assets.hostname_group = value.assets.hostname_group ? value.assets.hostname_group.split(',') : []
}
if (!Array.isArray(value.system_users.protocol_group)) {
value.system_users.protocol_group = value.system_users.protocol_group ? value.system_users.protocol_group.split(',') : []
if (!Array.isArray(value.accounts.name_group)) {
value.accounts.name_group = value.accounts.name_group ? value.accounts.name_group.split(',') : []
}
if (!Array.isArray(value.system_users.name_group)) {
value.system_users.name_group = value.system_users.name_group ? value.system_users.name_group.split(',') : []
}
if (!Array.isArray(value.system_users.username_group)) {
value.system_users.username_group = value.system_users.username_group ? value.system_users.username_group.split(',') : []
if (!Array.isArray(value.accounts.username_group)) {
value.accounts.username_group = value.accounts.username_group ? value.accounts.username_group.split(',') : []
}
if (!Array.isArray(value.users.username_group)) {
value.users.username_group = value.users.username_group ? value.users.username_group.split(',') : []