Merge pull request #3170 from jumpserver/pr@dev@perf_acls_connect_methods

perf: 用户登录 ACL 挪到控制中
This commit is contained in:
老广
2023-06-08 14:51:26 +08:00
committed by GitHub
24 changed files with 546 additions and 310 deletions

View File

@@ -149,7 +149,9 @@
"Rules": "Rule",
"Action": "Action",
"ipGroupHelpText": "* means match all. Example: 192.168.10.1, 192.168.1.0/24, 10.1.1.1-10.1.1.20, 2001:db8:2de::e13, 2001:db8:1a:1110::/64",
"apply_login_account": "Apply login account"
"apply_login_account": "Apply login account",
"UserIP": "Login IP",
"LoginIP": "Login IP"
},
"applications": {
"": "",
@@ -469,9 +471,8 @@
"ReLoginErr": "Login time has exceeded 5 minutes, please login again"
},
"common": {
"BatchProcessing": "Select {Number} items",
"Generate": "Generate",
"BatchProcessing": "Batch processing(select {Number} items)",
"Generate": "Generate",
"ServerError": "Server Error",
"CommunityEdition": "Community Edition",
"EnterpriseEdition": "Enterprise Edition",
@@ -838,7 +839,16 @@
"MatchIn": "In ...",
"RelNot": "Not",
"RelOr": "Or",
"Relation": "Relation"
"Relation": "Relation",
"Email": "Email",
"SelectAttrs": "Select attrs",
"MatchResult": "Match results",
"MatchedCount": "Match count",
"IsActive": "Is active",
"LessEqualThan": "Less than or equal to",
"OtherRules": "Other rules",
"BelongTo": "Belong to",
"GreatEqualThan": "Greater than or equal to"
},
"dashboard": {
"ActiveAsset": "Asset active",
@@ -1357,7 +1367,14 @@
"Execution": "Execution history",
"AssignedTicketList": "Todo approval",
"JobDetail": "Job detail",
"Clouds": "Cloud"
"Clouds": "Cloud",
"Acls": "Acls",
"UserLoginAclCreate": "Create user login acl",
"UserLoginAclUpdate": "Update user login acl",
"UserLoginAclList": "User login acl",
"ConnectMethodAclCreate": "Create connect method acl",
"ConnectMethodAclList": "Connect method acl",
"ConnectMethodAclUpdate": "Update connect method acl"
},
"rbac": {
"Permissions": "Permissions",
@@ -1374,7 +1391,9 @@
"HostDeployment": "Remote host deployment",
"TerminalStat": "CPU/MEM/DISK",
"DatabasePort": "Database protocol port",
"BasePort": "listening port"
"BasePort": "listening port",
"Endpoint": "Endpoint",
"ConnectMethod": "Connect method"
},
"sessions": {
"SetToDefaultStorage": "Set to default storage",
@@ -2154,4 +2173,4 @@
"PublishStatus": "Publish status",
"NoPublished": "Unpublished"
}
}
}

View File

@@ -149,7 +149,9 @@
"apply_login_user": "ログインユーザーの申請",
"login_confirm_user": "登録再確認受付者",
"RuleDetail": "ルールの詳細",
"apply_login_account": "ログインアカウントの申請"
"apply_login_account": "ログインアカウントの申請",
"UserIP": "ログインIP",
"LoginIP": "ログインIP"
},
"applications": {
"": "",
@@ -469,9 +471,8 @@
"ReLoginErr": "ログイン時間が 5 分を超えました。もう一度ログインしてください"
},
"common": {
"BatchProcessing": "選択 {Number} 項目",
"Generate": "生成",
"BatchProcessing": "一括処理(選択 {Number} 項目)",
"Generate": "生成",
"ServerError": "サーバーエラー",
"RestoreDefault": "デフォルトに戻す",
"DownloadCenter": "ダウンロードセンター",
@@ -837,7 +838,16 @@
"MatchIn": "以下のいずれかに一致する",
"RelNot": "でない",
"RelOr": "または",
"Relation": "関係"
"Relation": "関係",
"Email": "Email",
"SelectAttrs": "選擇屬性",
"MatchResult": "マッチ結果",
"MatchedCount": "一致する結果",
"IsActive": "アクティブです",
"LessEqualThan": "以下または等しい",
"OtherRules": "他のルール",
"BelongTo": "所属する",
"GreatEqualThan": "以上または等しい"
},
"dashboard": {
"TotalJobLog": "ジョブ実行総数",
@@ -1352,7 +1362,14 @@
"AppletHostCreate": "リモート アプリケーション発行者を追加する",
"Execution": "実行履歴",
"JobDetail": "仕事の詳細",
"Clouds": "クラウド プラットフォーム"
"Clouds": "クラウド プラットフォーム",
"Acls": "ファンアクセスコントロール",
"UserLoginAclCreate": "ユーザーログイン制御の作成",
"UserLoginAclUpdate": "ユーザーログイン制御ルールの更新",
"UserLoginAclList": "ユーザーログイン",
"ConnectMethodAclCreate": "接続方式制御の作成",
"ConnectMethodAclList": "接続方式",
"ConnectMethodAclUpdate": "接続方式制御ルールの更新"
},
"rbac": {
"Permissions": "権限",
@@ -1369,7 +1386,9 @@
"HostDeployment": "パブリッシャーの導入",
"TerminalStat": "CPU/メモリ/ディスク",
"DatabasePort": "データベース プロトコル ポート",
"BasePort": "リスニング ポート"
"BasePort": "リスニング ポート",
"Endpoint": "エンドポイント",
"ConnectMethod": "接続方式"
},
"sessions": {
"SetToDefaultStorage": "デフォルトストレージに設定",
@@ -2146,4 +2165,4 @@
"PublishStatus": "投稿ステータス",
"NoPublished": "未発表"
}
}
}

View File

@@ -115,6 +115,10 @@
}
},
"acl": {
"CommandFilterACLHelpMsg": "通过命令过滤,您可以控制命令是否可以发送到资产上。根据您设定的规则,某些命令可以被放行,而另一些命令则被禁止。",
"AssetLoginACLHelpMsg": "登录资产时,可以根据用户的登录 IP 和时间段进行审核,判断是否可以登录资产",
"UserLoginACLHelpMsg": "登录系统时,可以根据用户的登录 IP 和时间段进行审核,判断是否可以登录系统",
"ConnectMethodACLHelpMsg": "通过连接方式过滤,您可以控制用户是否可以使用某种连接方式登录到资产上。根据您设定的规则,某些连接方式可以被放行,而另一些连接方式则被禁止。",
"LoginIP": "登录 IP",
"UserIP": "登录 IP",
"apply_login_account": "申请登录账号",
@@ -1079,6 +1083,7 @@
},
"perms": {
"": "",
"AssetPermissionHelpMsg": "资产授权允许您选择用户和资产,将资产授权给用户以便访问。一旦授权完成,用户便可便捷地浏览这些资产。此外,您还可以设置特定的权限位,以进一步定义用户对资产的权限范围。",
"AccountsHelp": "<b>所有账号</b>: 资产上已添加的所有账号; <br/> <b>指定账号</b>:指定资产下账号的用户名;<br/>手动账号: 用户名/密码 登录时手动输入; <br/>同名账号: 与被授权人用户名相同的账号;",
"AllAccounts": "所有账号",
"AllAccountTip": "资产上已添加的所有账号",
@@ -1150,6 +1155,13 @@
},
"route": {
"": "",
"Acls": "访问控制",
"UserLoginAclCreate": "创建用户登录控制",
"UserLoginAclList": "用户登录",
"UserLoginAclUpdate": "更新用户登录控制",
"ConnectMethodAclList": "连接方式",
"ConnectMethodAclCreate": "创建连接方式控制",
"ConnectMethodAclUpdate": "更新连接方式控制",
"AppletDetail": "远程应用",
"AppletHostDetail": "远程应用发布机详情",
"AppletHostCreate": "添加远程应用发布机",
@@ -1220,7 +1232,7 @@
"CommandExecutions": "命令执行",
"CommandFilterCreate": "创建命令过滤器",
"CommandFilterDetail": "命令过滤器详情",
"CommandFilterList": "命令过滤",
"CommandFilterList": "命令过滤规则",
"CommandFilterRulesCreate": "创建命令过滤器规则",
"CommandFilterRulesUpdate": "更新命令过滤器规则",
"CommandFilterUpdate": "更新命令过滤器",
@@ -1369,7 +1381,8 @@
"uploadZipTips": "请上传 zip 格式的文件",
"HostDeployment": "发布机部署",
"TerminalStat": "CPU/内存/磁盘",
"Endpoint": "端点"
"Endpoint": "端点",
"ConnectMethod": "连接方式"
},
"sessions": {
"SetToDefaultStorage": "设置为默认存储",

1
src/icons/svg/unlock.svg Normal file
View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg width="32" height="32" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="6" y="22" width="36" height="22" rx="2" fill="none" stroke="#646a73" stroke-width="4" stroke-linejoin="round"/><path d="M14 22V14C14 8.47715 18.4772 4 24 4C29.5228 4 34 8.47715 34 14V22" stroke="#646a73" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M24 30V36" stroke="#646a73" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>

After

Width:  |  Height:  |  Size: 520 B

227
src/router/console/acls.js Normal file
View File

@@ -0,0 +1,227 @@
import i18n from '@/i18n/i18n'
import empty from '@/layout/empty'
export default [
{
path: 'login-asset-acls',
component: empty,
redirect: '',
meta: {
title: i18n.t('route.AssetAclList'),
licenseRequired: true,
app: 'acls',
resource: 'loginassetacl'
},
children: [
{
path: '',
name: 'AssetAclList',
component: () => import('@/views/acl/AssetLoginAcl/AssetLoginAclList.vue'),
meta: { title: i18n.t('route.AssetAclList') }
},
{
path: 'create',
name: 'AssetAclCreate',
component: () => import('@/views/acl/AssetLoginAcl/AssetLoginAclCreateUpdate.vue'),
hidden: true,
meta: { title: i18n.t('route.AssetAclCreate') }
},
{
path: ':id',
name: 'AssetAclDetail',
component: () => import('@/views/acl/AssetLoginAcl/AssetLoginAclDetail/index'),
hidden: true,
meta: { title: i18n.t('route.AssetAclDetail') }
},
{
path: ':id/update',
name: 'AssetAclUpdate',
component: () => import('@/views/acl/AssetLoginAcl/AssetLoginAclCreateUpdate.vue'),
hidden: true,
meta: { title: i18n.t('route.AssetAclUpdate') }
}
]
},
{
path: 'cmd-acls',
component: empty,
redirect: '',
meta: {
title: i18n.t('route.CommandFilterAclList'),
app: 'acls',
resource: 'commandfilteracl',
activeMenu: '/console/perms/cmd-acls'
},
children: [
// Command Filter ACL
{
path: '',
name: 'CommandFilterAclList',
component: () => import('@/views/acl/CommandAcl/index'),
hidden: true,
meta: { title: i18n.t('route.CommandFilterAclList') }
},
{
path: 'create',
name: 'CommandFilterAclCreate',
component: () => import('@/views/acl/CommandAcl/CommandFilterAcl/CommandFilterAclCreateUpdate'),
hidden: true,
meta: { title: i18n.t('route.CommandFilterAclCreate') }
},
{
path: ':id',
name: 'CommandFilterAclDetail',
component: () => import('@/views/acl/CommandAcl/CommandFilterAcl/CommandFilterAclDetail/index'),
hidden: true,
meta: { title: i18n.t('route.CommandFilterAclDetail') }
},
{
path: ':id/update',
name: 'CommandFilterAclUpdate',
component: () => import('@/views/acl/CommandAcl/CommandFilterAcl/CommandFilterAclCreateUpdate'),
hidden: true,
meta: { title: i18n.t('route.CommandFilterAclUpdate') }
}
]
},
{
path: 'cmd-groups',
component: empty,
redirect: '',
meta: {
title: i18n.t('route.CommandGroupList'),
app: 'acls',
resource: 'commandgroup',
activeMenu: '/console/perms/cmd-acls'
},
hidden: true,
children: [
// Command Group
{
path: '',
name: 'CommandGroupList',
component: () => import('@/views/acl/CommandAcl/index'),
hidden: true,
meta: {
title: i18n.t('route.CommandGroupList'),
activeMenu: '/console/perms/cmd-acls'
}
},
{
path: 'create',
name: 'CommandGroupCreate',
component: () => import('@/views/acl/CommandAcl/CommandGroup/CommandGroupCreateUpdate'),
hidden: true,
meta: {
title: i18n.t('route.CommandGroupCreate'),
activeMenu: '/console/perms/cmd-acls'
}
},
{
path: ':id',
name: 'CommandGroupDetail',
component: () => import('@/views/acl/CommandAcl/CommandGroup/CommandGroupDetail/index'),
hidden: true,
meta: {
title: i18n.t('route.CommandGroupDetail'),
activeMenu: '/console/perms/cmd-acls'
}
},
{
path: ':id/update',
name: 'CommandGroupUpdate',
component: () => import('@/views/acl/CommandAcl/CommandGroup/CommandGroupCreateUpdate'),
hidden: true,
meta: {
title: i18n.t('route.CommandGroupUpdate'),
activeMenu: '/console/perms/cmd-acls'
}
}
]
},
{
path: 'login-acls',
component: empty,
redirect: '',
meta: {
title: i18n.t('route.UserLoginAclList'),
app: 'acls',
resource: 'loginacl'
},
children: [
{
path: '',
name: 'UserLoginAclList',
component: () => import('@/views/acl/UserLoginACL/UserLoginACLList.vue'),
meta: { title: i18n.t('route.UserLoginAclList') }
},
{
path: 'create',
name: 'UserLoginAclCreate',
component: () => import('@/views/acl/UserLoginACL/UserLoginACLCreateUpdate.vue'),
hidden: true,
meta: {
title: i18n.t('route.UserLoginAclCreate')
}
},
{
path: ':id',
name: 'UserLoginAclDetail',
component: () => import('@/views/acl/UserLoginACL/UserDetail/index'),
hidden: true,
meta: {
title: i18n.t('route.AssetAclDetail'),
app: 'acls',
resource: 'loginacl'
}
},
{
path: ':id/update',
name: 'UserLoginAclUpdate',
component: () => import('@/views/acl/UserLoginACL/UserLoginACLCreateUpdate.vue'),
hidden: true,
meta: { title: i18n.t('route.UserLoginAclUpdate') }
}
]
},
{
path: 'connect-method-acls',
component: empty,
redirect: '',
meta: {
title: i18n.t('route.ConnectMethodList'),
licenseRequired: true,
app: 'acls',
resource: 'connectmethodacl'
},
children: [
{
path: '',
name: 'ConnectMethodAclList',
component: () => import('@/views/acl/ConnectMethodAcl/ConnectMethodAclList.vue'),
meta: { title: i18n.t('route.ConnectMethodAclList') }
},
{
path: 'create',
name: 'ConnectMethodAclCreate',
component: () => import('@/views/acl/ConnectMethodAcl/ConnectMethodAclCreateUpdate.vue'),
hidden: true,
meta: { title: i18n.t('route.ConnectMethodAclCreate') }
},
{
path: ':id',
name: 'ConnectMethodAclDetail',
component: () => import('@/views/acl/AssetLoginAcl/AssetLoginAclDetail/index'),
hidden: true,
meta: { title: i18n.t('route.AssetAclDetail') }
},
{
path: ':id/update',
name: 'ConnectMethodAclUpdate',
component: () => import('@/views/acl/ConnectMethodAcl/ConnectMethodAclCreateUpdate.vue'),
hidden: true,
meta: { title: i18n.t('route.ConnectMethodAclUpdate') }
}
]
}
]

View File

@@ -68,12 +68,14 @@ export default {
path: '/console/perms',
component: empty,
name: 'Perms',
alwaysShow: false,
meta: {
title: i18n.t('route.Perms'),
icon: 'permission'
},
children: PermsRoute
}
]
}

View File

@@ -1,5 +1,6 @@
import i18n from '@/i18n/i18n'
import empty from '@/layout/empty'
import ACLRoutes from '@/router/console/acls'
export default [
{
@@ -39,141 +40,5 @@ export default [
}
]
},
{
path: 'login-asset-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/index'),
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') }
}
]
},
{
path: 'cmd-acls',
component: empty,
redirect: '',
meta: {
title: i18n.t('route.CommandFilterAclList'),
app: 'acls',
resource: 'commandfilteracl',
activeMenu: '/console/perms/cmd-acls'
},
children: [
// Command Filter ACL
{
path: '',
name: 'CommandFilterAclList',
component: () => import('@/views/acl/CommandAcl/index'),
hidden: true,
meta: { title: i18n.t('route.CommandFilterAclList') }
},
{
path: 'create',
name: 'CommandFilterAclCreate',
component: () => import('@/views/acl/CommandAcl/CommandFilterAcl/CommandFilterAclCreateUpdate'),
hidden: true,
meta: { title: i18n.t('route.CommandFilterAclCreate') }
},
{
path: ':id',
name: 'CommandFilterAclDetail',
component: () => import('@/views/acl/CommandAcl/CommandFilterAcl/CommandFilterAclDetail/index'),
hidden: true,
meta: { title: i18n.t('route.CommandFilterAclDetail') }
},
{
path: ':id/update',
name: 'CommandFilterAclUpdate',
component: () => import('@/views/acl/CommandAcl/CommandFilterAcl/CommandFilterAclCreateUpdate'),
hidden: true,
meta: { title: i18n.t('route.CommandFilterAclUpdate') }
}
]
},
{
path: 'cmd-groups',
component: empty,
redirect: '',
meta: {
title: i18n.t('route.CommandGroupList'),
app: 'acls',
resource: 'commandgroup',
activeMenu: '/console/perms/cmd-acls'
},
hidden: true,
children: [
// Command Group
{
path: '',
name: 'CommandGroupList',
component: () => import('@/views/acl/CommandAcl/index'),
hidden: true,
meta: {
title: i18n.t('route.CommandGroupList'),
activeMenu: '/console/perms/cmd-acls'
}
},
{
path: 'create',
name: 'CommandGroupCreate',
component: () => import('@/views/acl/CommandAcl/CommandGroup/CommandGroupCreateUpdate'),
hidden: true,
meta: {
title: i18n.t('route.CommandGroupCreate'),
activeMenu: '/console/perms/cmd-acls'
}
},
{
path: ':id',
name: 'CommandGroupDetail',
component: () => import('@/views/acl/CommandAcl/CommandGroup/CommandGroupDetail/index'),
hidden: true,
meta: {
title: i18n.t('route.CommandGroupDetail'),
activeMenu: '/console/perms/cmd-acls'
}
},
{
path: ':id/update',
name: 'CommandGroupUpdate',
component: () => import('@/views/acl/CommandAcl/CommandGroup/CommandGroupCreateUpdate'),
hidden: true,
meta: {
title: i18n.t('route.CommandGroupUpdate'),
activeMenu: '/console/perms/cmd-acls'
}
}
]
}
...ACLRoutes
]

View File

@@ -2,7 +2,6 @@ import i18n from '@/i18n/i18n'
import empty from '@/layout/empty'
import { BASE_URL } from '@/utils/common'
// Todo: 放到系统设置中
export default [
{
path: 'sessions',

View File

@@ -44,47 +44,6 @@ export default [
name: 'UserDetail',
hidden: true,
meta: { title: i18n.t('route.UserDetail') }
},
{
path: 'user-acl',
component: empty,
redirect: '',
hidden: true,
meta: {
title: i18n.t('route.UserLoginACLList'),
app: 'acls',
resource: 'loginacl'
},
children: [
{
path: '',
name: 'UserLoginACLList',
component: () => import('@/views/acl/UserLoginACL/UserLoginACLList'),
hidden: true,
meta: { title: i18n.t('route.UserLoginACLList') }
},
{
path: 'create',
name: 'UserLoginACLCreate',
component: () => import('@/views/acl/UserLoginACL/UserLoginACLCreateUpdate'),
hidden: true,
meta: { title: i18n.t('route.UserLoginACLCreate') }
},
{
path: ':id',
name: 'UserLoginACLDetail',
component: () => import('@/views/acl/UserLoginACL/UserDetail/index'),
hidden: true,
meta: { title: i18n.t('route.UserLoginACLDetail') }
},
{
path: ':id/update',
name: 'UserLoginACLUpdate',
component: () => import('@/views/acl/UserLoginACL/UserLoginACLCreateUpdate'),
hidden: true,
meta: { title: i18n.t('route.UserLoginACLUpdate') }
}
]
}
]
},

View File

@@ -107,7 +107,10 @@ export async function generatePageRoutes({ to, from, next }) {
hidden: true
}]
// dynamically add accessible routes
Vue.$log.debug('All routes:', accessRoutes)
Vue.$log.debug('All routes:', accessRoutes.reduce((acc, cur) => {
acc[cur.name] = cur
return acc
}, {}))
router.addRoutes(accessRoutes)
await store.dispatch('permission/generateViewRoutes', { to, from })

View File

@@ -19,11 +19,9 @@ export default {
return {
initial: {
accounts: ['@ALL'],
rules: [
{
ip_group: ['*']
}
]
rules: {
ip_group: ['*']
}
},
fields: [
[this.$t('common.Basic'), ['name', 'priority']],

View File

@@ -1,5 +1,5 @@
<template>
<GenericListPage :table-config="tableConfig" :header-actions="headerActions" />
<GenericListPage :header-actions="headerActions" :help-message="helpMsg" :table-config="tableConfig" />
</template>
<script>
@@ -11,6 +11,7 @@ export default {
},
data() {
return {
helpMsg: this.$t('acl.AssetLoginACLHelpMsg'),
tableConfig: {
url: '/api/v1/acls/login-asset-acls/',
columnsExclude: ['users', 'assets', 'accounts'],

View File

@@ -1,5 +1,9 @@
<template>
<ListTable :header-actions="headerActions" :table-config="tableConfig" />
<div>
<el-alert type="success">{{ helpMsg }}</el-alert>
<ListTable :header-actions="headerActions" :table-config="tableConfig" />
</div>
</template>
<script>
@@ -12,6 +16,7 @@ export default {
},
data() {
return {
helpMsg: this.$t('acl.CommandFilterACLHelpMsg'),
tableConfig: {
url: '/api/v1/acls/command-filter-acls/',
permissions: {

View File

@@ -0,0 +1,71 @@
<template>
<GenericCreateUpdatePage v-bind="$data" />
</template>
<script>
import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage'
import rules from '@/components/DataForm/rules'
import { userJSONSelectMeta } from '@/views/users/const'
import { assetJSONSelectMeta } from '@/views/assets/const'
import { Select2 } from '@/components/FormFields'
export default {
name: 'AclCreateUpdate',
components: {
GenericCreateUpdatePage
},
data() {
return {
initial: {
},
fields: [
[this.$t('common.Basic'), ['name', 'priority']],
[this.$t('users.Users'), ['users']],
[this.$t('terminal.ConnectMethod'), ['connect_methods']],
[this.$t('common.Action'), ['action', 'reviewers']],
[this.$t('common.Other'), ['is_active', 'comment']]
],
fieldsMeta: {
priority: {
rules: [rules.Required]
},
assets: assetJSONSelectMeta(this),
users: userJSONSelectMeta(this),
connect_methods: {
component: Select2,
label: this.$t('terminal.ConnectMethod'),
el: {
url: '/api/v1/terminal/components/connect-methods/?flat=1&limit=10&os=all',
ajax: {
processResults: (data) => {
return {
results: data,
more: false
}
}
}
}
},
reviewers: {
hidden: (item) => item.action !== 'review',
rules: [rules.RequiredChange],
el: {
value: [],
ajax: {
url: '/api/v1/users/users/?fields_size=mini',
transformOption: (item) => {
return { label: item.name + '(' + item.username + ')', value: item.id }
}
}
}
}
},
url: '/api/v1/acls/connect-method-acls/'
}
},
methods: {}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,36 @@
<template>
<GenericListPage :header-actions="headerActions" :help-message="helpText" :table-config="tableConfig" />
</template>
<script>
import GenericListPage from '@/layout/components/GenericListPage/index.vue'
export default {
name: 'ConnectMethodListAcl',
components: { GenericListPage },
data() {
return {
helpText: this.$t('acl.ConnectMethodACLHelpMsg'),
tableConfig: {
url: '/api/v1/acls/connect-method-acls/',
columnsExclude: ['users', 'assets', 'accounts'],
columnsShow: {
min: ['name', 'actions'],
default: [
'name', 'priority', 'is_active', 'comment', 'actions'
]
}
},
headerActions: {
hasRefresh: true,
hasExport: false,
hasImport: false
}
}
}
}
</script>
<style scoped>
</style>

View File

@@ -1,5 +1,5 @@
<template>
<GenericDetailPage :object.sync="TaskDetail" :active-menu.sync="config.activeMenu" v-bind="config" v-on="$listeners">
<GenericDetailPage :active-menu.sync="config.activeMenu" :object.sync="TaskDetail" v-bind="config" v-on="$listeners">
<keep-alive>
<component :is="config.activeMenu" :object="TaskDetail" />
</keep-alive>
@@ -9,6 +9,7 @@
<script>
import { GenericDetailPage } from '@/layout/components'
import Detail from './Detail.vue'
export default {
components: {
GenericDetailPage,
@@ -27,8 +28,8 @@ export default {
],
hasRightSide: false,
actions: {
detailApiUrl: `/api/v1/acls/login-acls/${this.$route.params.id}/?user=${this.$route.query.user}`,
deleteApiUrl: `/api/v1/acls/login-acls/${this.$route.params.id}/?user=${this.$route.query.user}`
detailApiUrl: `/api/v1/acls/login-acls/${this.$route.params.id}/`,
deleteApiUrl: `/api/v1/acls/login-acls/${this.$route.params.id}/`
}
}
}

View File

@@ -1,14 +1,12 @@
<template>
<GenericCreateUpdatePage
:after-get-form-value="afterGetFormValue"
v-bind="$data"
/>
<GenericCreateUpdatePage v-bind="$data" />
</template>
<script>
import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage'
import { WeekCronSelect } from '@/components/FormFields'
import { Required } from '@/components/DataForm/rules'
import { userJSONSelectMeta } from '@/views/users/const'
export default {
name: 'AclCreateUpdate',
@@ -23,17 +21,15 @@ export default {
users: {
username_group: ''
},
rules: [
{
ip_group: ['*']
}
]
rules: {
ip_group: ['*']
}
},
url: '/api/v1/acls/login-acls/',
hasDetailInMsg: false,
fields: [
[this.$t('common.Basic'), ['name', 'priority']],
[this.$t('acl.users'), ['user']],
[this.$t('acl.users'), ['users']],
[this.$t('acl.Rules'), ['rules']],
[this.$t('acl.Action'), ['action', 'reviewers']],
[this.$t('common.Other'), ['is_active', 'comment']]
@@ -42,18 +38,7 @@ export default {
is_active: {
type: 'checkbox'
},
user: {
el: {
disabled: !!this.$route.query.user,
multiple: false,
ajax: {
url: '/api/v1/users/users/?fields_size=mini&all=true',
transformOption: (item) => {
return { label: item.name + '(' + item.username + ')', value: item.id }
}
}
}
},
users: userJSONSelectMeta(this),
reviewers: {
el: {
value: [],
@@ -97,46 +82,10 @@ export default {
}
return url
},
updateSuccessNextRoute: this.$route.query.user ? { name: 'UserDetail', params: {
id: this.$route.query.user
}} : { name: 'UserLoginACLList' },
createSuccessNextRoute: this.$route.query.user ? { name: 'UserDetail', params: {
id: this.$route.query.user
}} : { name: 'UserLoginACLList' },
onPerformError(error, method, vm) {
this.$emit('submitError', error)
const response = error.response
const data = response.data
if (response.status === 400) {
for (const key of Object.keys(data)) {
let value = data[key]
if (key === 'ip_group') {
value = Object.values(data[key])
}
if (value instanceof Array) {
value = value.join(';')
}
this.$refs.form.setFieldError(key, value)
}
}
},
afterGetFormValue(validValues) {
if (!this.$route.query.user) {
validValues.users.username_group = validValues.users.username_group.toString()
}
return validValues
},
cleanFormValue(value) {
if (!Array.isArray(value.rules.ip_group)) {
value.rules.ip_group = value.rules.ip_group ? value.rules.ip_group.split(',') : []
}
if (!this.$route.query.user) {
if (!Array.isArray(value.users.username_group)) {
value.users.username_group = value.users.username_group ? value.users.username_group.split(',') : []
}
} else {
delete value.users
}
if (value.action !== 'review') {
value.reviewers = []
}

View File

@@ -1,55 +1,22 @@
<template>
<GenericListTable :table-config="tableConfig" :header-actions="headerActions" />
<Page :help-message="helpMsg">
<UserLoginACLTable />
</Page>
</template>
<script>
import GenericListTable from '@/layout/components/GenericListTable'
import UserLoginACLTable from '@/views/acl/UserLoginACL/UserLoginACLTable.vue'
import Page from '@/layout/components/Page'
export default {
components: {
GenericListTable
UserLoginACLTable,
Page
},
data() {
return {
tableConfig: {
url: `/api/v1/acls/login-acls/?user=${this.$route.params.id}`,
columnsExclude: ['rules'],
columnsShow: {
min: ['name', 'actions'],
default: ['name', 'priority', 'is_active', 'user_display', 'action', 'comment', 'actions']
},
columnsMeta: {
name: {
formatterArgs: {
route: 'UserLoginACLDetail',
routeQuery: {
user: this.$route.params.id
}
}
},
reviewers_amount: {
label: this.$t('common.ApproverNumbers')
},
actions: {
formatterArgs: {
hasClone: false,
updateRoute: { name: 'UserLoginACLUpdate', query: { user: this.$route.params.id }},
performDelete: ({ row, col }) => {
const id = row.id
const url = `/api/v1/acls/login-acls/${id}/?user=${this.$route.params.id}`
return this.$axios.delete(url)
}
}
}
}
},
headerActions: {
createRoute: { name: 'UserLoginACLCreate', query: { user: this.$route.params.id }},
hasRefresh: true,
hasExport: false,
hasImport: false,
hasMoreActions: false
}
helpMsg: this.$t('acl.UserLoginACLHelpMsg')
}
}
}

View File

@@ -0,0 +1,70 @@
<template>
<ListTable :header-actions="headerActions" :table-config="tableConfig" />
</template>
<script>
import ListTable from '@/components/ListTable/index.vue'
export default {
components: {
ListTable
},
props: {
url: {
type: String,
default: '/api/v1/acls/login-acls/'
}
},
data() {
return {
tableConfig: {
url: this.url,
columnsExclude: ['rules'],
columnsShow: {
min: ['name', 'actions'],
default: [
'name', 'priority', 'is_active',
'action', 'comment', 'actions'
]
},
columnsMeta: {
name: {
formatterArgs: {
route: 'UserLoginAclDetail'
}
},
reviewers_amount: {
label: this.$t('common.ApproverNumbers')
},
actions: {
formatterArgs: {
hasClone: false,
updateRoute: ({ row }) => {
console.log('row', row)
return {
name: 'UserLoginAclUpdate',
params: {
id: row.id
}
}
}
}
}
}
},
headerActions: {
hasRefresh: true,
hasExport: false,
hasImport: false,
hasMoreActions: false,
createRoute: 'UserLoginAclCreate'
}
}
}
}
</script>
<style>
</style>

View File

@@ -1,5 +1,5 @@
<template>
<Page v-bind="$attrs">
<Page :help-message="helpMsg" v-bind="$attrs">
<AssetTreeTable
ref="AssetTreeTable"
:header-actions="headerActions"
@@ -30,6 +30,7 @@ export default {
},
data() {
return {
helpMsg: this.$t('perms.AssetPermissionHelpMsg'),
treeSetting: {
showMenu: false,
showAssets: true,

View File

@@ -0,0 +1,30 @@
<template>
<UserLoginACLTable :url="url" />
</template>
<script>
import UserLoginACLTable from '@/views/acl/UserLoginACL/UserLoginACLTable.vue'
export default {
name: 'UserLoginAcl',
components: {
UserLoginACLTable
},
props: {
object: {
type: Object,
required: true
}
},
data() {
return {
url: '/api/v1/acls/login-acls/?users=' + this.object.id
}
}
}
</script>
<style scoped>
</style>

View File

@@ -10,14 +10,14 @@
import { GenericDetailPage } from '@/layout/components'
import UserAssetPermissionRules from './UserAssetPermissionRules'
import UserGrantedAssets from './UserGrantedAssets'
import UserLoginACLList from '@/views/acl/UserLoginACL/UserLoginACLList'
import UserInfo from './UserInfo'
import UserLoginAcl from './UserLoginAcl.vue'
import { mapGetters } from 'vuex'
export default {
components: {
UserInfo,
UserLoginACLList,
UserLoginAcl,
GenericDetailPage,
UserGrantedAssets,
UserAssetPermissionRules
@@ -51,7 +51,7 @@ export default {
},
{
title: this.$t('route.UserAclLists'),
name: 'UserLoginACLList',
name: 'UserLoginAcl',
hidden: () => !vm.$hasPerm('acls.view_loginacl')
}
]