Compare commits

...

17 Commits

Author SHA1 Message Date
“huailei000”
8697ea629d fix: 修复概览页路由跳转权限判断问题 2022-04-11 15:22:15 +08:00
feng626
cd520c7b95 fix: 修复消息订阅无法更新bug 2022-04-08 16:07:02 +08:00
“huailei000”
3ac7c04ff0 fix: 修复终端管理-批量更新弹窗不显示label问题 2022-04-08 15:22:22 +08:00
feng626
521e33adff fix: 修改系统用户类型 2022-04-06 14:24:50 +08:00
ibuler
9926065ab0 perf: 优化 data action 高度 2022-04-02 15:55:20 +08:00
“huailei000”
68fb4b4e99 fix:修复资产列表-从节点移除 权限位不准确问题 2022-03-25 14:43:09 +08:00
feng626
43badfa0b3 fix: user org perm 2022-03-22 16:58:34 +08:00
“huailei000”
d3cfcbf71f fix: 修复系统用户-资产列表按钮权限不准确问题 2022-03-21 19:24:19 +08:00
feng626
89141636a2 Merge pull request #1600 from jumpserver/pr@v2.20@asset_user_perm
fix: 修复资产详情中授权用户可查看用户权限
2022-03-21 11:16:26 +08:00
feng626
085789f6c5 fix: 修复资产详情中授权用户可查看用户权限 2022-03-21 10:58:42 +08:00
Jiangjie.Bai
0f47f99786 fix: 从节点移除资产权限位修改 2022-03-18 17:11:20 +08:00
Jiangjie.Bai
a549f3f81f fix: 修复资产详情系统用户页面权限控制 2022-03-18 16:54:08 +08:00
Jiangjie.Bai
3b54ad8b00 fix: 修复工单中会话卡片按钮的权限控制 2022-03-18 16:40:51 +08:00
Jiangjie.Bai
e5e976e007 fix: 修复角色更新、删除权限控制 2022-03-18 14:52:53 +08:00
ibuler
ad4ddcd1c0 perf: 优化 form label 位置 2022-03-17 20:31:26 +08:00
ibuler
944aba8b26 perf: 优化详情中btn 2022-03-17 19:52:41 +08:00
ibuler
36d8e8cca6 perf: 优化移动端显示 2022-03-17 19:46:58 +08:00
19 changed files with 75 additions and 45 deletions

View File

@@ -1,5 +1,5 @@
<template> <template>
<div :class="grouped ? 'el-button-group' : 'el-button-ungroup'"> <div :class="grouped ? 'el-button-group' : 'el-button-ungroup'" style="display: flex">
<template v-for="action in iActions"> <template v-for="action in iActions">
<el-dropdown <el-dropdown
v-if="action.dropdown" v-if="action.dropdown"
@@ -13,7 +13,7 @@
<el-button :size="size" v-bind="cleanButtonAction(action)"> <el-button :size="size" v-bind="cleanButtonAction(action)">
{{ action.title }}<i class="el-icon-arrow-down el-icon--right" /> {{ action.title }}<i class="el-icon-arrow-down el-icon--right" />
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown" style="overflow: auto;max-height: 60vh">
<template v-for="option in action.dropdown"> <template v-for="option in action.dropdown">
<div v-if="option.group" :key="'group:'+option.name" class="dropdown-menu-title" style="width:130px"> <div v-if="option.group" :key="'group:'+option.name" class="dropdown-menu-title" style="width:130px">
{{ option.group }} {{ option.group }}

View File

@@ -1,9 +1,10 @@
<template> <template>
<ElFormRender <ElFormRender
ref="form" ref="form"
:class="mobile? 'mobile' : 'desktop'"
:content="fields" :content="fields"
:form="basicForm" :form="basicForm"
label-position="right" :label-position="labelPosition"
label-width="20%" label-width="20%"
v-bind="$attrs" v-bind="$attrs"
v-on="$listeners" v-on="$listeners"
@@ -68,6 +69,14 @@ export default {
basicForm: this.form basicForm: this.form
} }
}, },
computed: {
mobile() {
return this.$store.state.app.device === 'mobile'
},
labelPosition() {
return this.mobile ? 'top' : 'right'
}
},
methods: { methods: {
// 获取表单数据 // 获取表单数据
submitForm(formName, addContinue) { submitForm(formName, addContinue) {
@@ -99,27 +108,35 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.el-form ::v-deep .el-form-item { .el-form ::v-deep .el-form-item {
margin-bottom: 12px; margin-bottom: 12px;
} }
.el-form ::v-deep .el-form-item__content { .el-form ::v-deep .el-form-item__content {
width: 75%; width: 75%;
} }
.el-form ::v-deep .el-form-item__label { .mobile.el-form ::v-deep .el-form-item__content {
width: 100%;
}
.el-form ::v-deep .el-form-item__label {
padding: 0 30px 0 0; padding: 0 30px 0 0;
} }
.el-form ::v-deep .el-form-item__error { .el-form ::v-deep .el-form-item__error {
position: inherit; position: inherit;
} }
.el-form ::v-deep .form-group-header { .el-form ::v-deep .form-group-header {
margin-left: 50px; margin-left: 50px;
} }
.el-form ::v-deep .help-block { .el-form.mobile ::v-deep .form-group-header {
margin-left: 0;
}
.el-form ::v-deep .help-block {
display: block; display: block;
margin-top: 5px; margin-top: 5px;
margin-bottom: 10px; margin-bottom: 10px;
@@ -127,7 +144,7 @@ export default {
font-size: 12px; font-size: 12px;
line-height: 18px; line-height: 18px;
} }
.el-form ::v-deep .help-block a { .el-form ::v-deep .help-block a {
color: #1c84c6; color: #1c84c6;
} }
.form-buttons { .form-buttons {

View File

@@ -65,4 +65,7 @@ export default {
margin-right: 5px; margin-right: 5px;
vertical-align: middle; vertical-align: middle;
} }
.mobile .header-avatar {
display: none;
}
</style> </style>

View File

@@ -4,13 +4,13 @@
<div class="nav-logo"> <div class="nav-logo">
<Logo v-if="showLogo" :collapse="isCollapse" /> <Logo v-if="showLogo" :collapse="isCollapse" />
</div> </div>
<div class="nav-title" :class="{'collapsed': isCollapse}">
{{ isTitle }}
</div>
<div class="active-mobile"> <div class="active-mobile">
<ViewSwitcher /> <ViewSwitcher />
<Organization class="organization" /> <Organization class="organization" />
</div> </div>
<div class="nav-title" :class="{'collapsed': isCollapse}">
{{ isTitle }}
</div>
</div> </div>
<el-scrollbar wrap-class="scrollbar-wrapper"> <el-scrollbar wrap-class="scrollbar-wrapper">
<el-menu <el-menu

View File

@@ -157,5 +157,9 @@ export const CLOUD = [
] ]
export const ApplicationTypes = [ export const ApplicationTypes = [
...REMOTE_APP, ...DATABASE, ...CLOUD ...DATABASE, ...REMOTE_APP, ...CLOUD
]
export const ApplicationSystemUserTypes = [
...DATABASE, ...CLOUD
] ]

View File

@@ -54,6 +54,7 @@ export default {
}, },
columnsMeta: { columnsMeta: {
name: { name: {
formatter: vm.$hasPerm('users.view_user') ? DetailFormatter : '',
formatterArgs: { formatterArgs: {
route: 'UserDetail' route: 'UserDetail'
}, },

View File

@@ -36,7 +36,7 @@ export default {
{ {
title: this.$t('assets.SystemUser'), title: this.$t('assets.SystemUser'),
name: 'SystemUserList', name: 'SystemUserList',
hidden: () => !this.$hasPerm('assets.view_systemuser') hidden: () => !this.$hasPerm('assets.view_authbook')
}, },
{ {
title: this.$t('assets.AccountList'), title: this.$t('assets.AccountList'),

View File

@@ -237,12 +237,12 @@ export default {
name: 'RemoveFromCurrentNode', name: 'RemoveFromCurrentNode',
title: this.$t('assets.RemoveFromCurrentNode'), title: this.$t('assets.RemoveFromCurrentNode'),
can: ({ selectedRows }) => { can: ({ selectedRows }) => {
if (!this.$route.query.node) { if (!vm.$route.query.node) {
return false return false
} }
return selectedRows.length > 0 && return selectedRows.length > 0 &&
!vm.currentOrgIsRoot && !vm.currentOrgIsRoot &&
vm.$hasPerm('assets.change_asset') vm.$hasPerm('assets.change_node')
}, },
callback: function({ selectedRows, reloadTable }) { callback: function({ selectedRows, reloadTable }) {
const assetsId = [] const assetsId = []

View File

@@ -68,7 +68,7 @@ export default {
name: 'Push', name: 'Push',
title: this.$t('common.Push'), title: this.$t('common.Push'),
type: 'primary', type: 'primary',
can: this.object.auto_push, can: this.object.auto_push && vm.$hasPerm('assets.push_assetsystemuser'),
callback: ({ row }) => { callback: ({ row }) => {
const theUrl = `/api/v1/assets/system-users/${vm.object.id}/tasks/` const theUrl = `/api/v1/assets/system-users/${vm.object.id}/tasks/`
const data = { action: 'push', assets: [row.asset] } const data = { action: 'push', assets: [row.asset] }
@@ -81,7 +81,7 @@ export default {
name: 'Delete', name: 'Delete',
title: this.$t('common.Delete'), title: this.$t('common.Delete'),
type: 'danger', type: 'danger',
can: !this.$store.getters.currentOrgIsRoot, can: !this.$store.getters.currentOrgIsRoot && vm.$hasPerm('assets.delete_authbook'),
callback: (val) => { callback: (val) => {
this.$axios.delete(`/api/v1/assets/system-users-assets-relations/${val.row.id}/`).then(() => { this.$axios.delete(`/api/v1/assets/system-users-assets-relations/${val.row.id}/`).then(() => {
this.$message.success(this.$t('common.deleteSuccessMsg')) this.$message.success(this.$t('common.deleteSuccessMsg'))
@@ -103,7 +103,7 @@ export default {
title: this.$t('common.PushSelected'), title: this.$t('common.PushSelected'),
name: 'PushSelected', name: 'PushSelected',
can({ selectedRows }) { can({ selectedRows }) {
return selectedRows.length > 0 && vm.object.auto_push return selectedRows.length > 0 && vm.object.auto_push && vm.$hasPerm('assets.push_assetsystemuser')
}, },
callback: this.bulkPushCallback.bind(this) callback: this.bulkPushCallback.bind(this)
}, },
@@ -111,7 +111,7 @@ export default {
title: this.$t('assets.TestAssetsConnective'), title: this.$t('assets.TestAssetsConnective'),
name: 'TestSelected', name: 'TestSelected',
can({ selectedRows }) { can({ selectedRows }) {
return selectedRows.length > 0 return selectedRows.length > 0 && vm.$hasPerm('assets.test_assetconnectivity')
}, },
callback: this.bulkTestCallback.bind(this) callback: this.bulkTestCallback.bind(this)
} }
@@ -122,7 +122,8 @@ export default {
title: this.$t('assets.TestAssetsConnective'), title: this.$t('assets.TestAssetsConnective'),
attrs: { attrs: {
type: 'primary', type: 'primary',
label: this.$t('common.Test') label: this.$t('common.Test'),
disabled: !vm.$hasPerm('assets.test_assetconnectivity')
}, },
callbacks: { callbacks: {
click: function() { click: function() {

View File

@@ -9,7 +9,7 @@
<script> <script>
import { GenericListTable } from '@/layout/components' import { GenericListTable } from '@/layout/components'
import { ApplicationTypes } from '@/views/applications/const' import { ApplicationSystemUserTypes } from '@/views/applications/const'
import { AssetProtocols } from '@/views/assets/const' import { AssetProtocols } from '@/views/assets/const'
export default { export default {
@@ -78,7 +78,7 @@ export default {
}, },
dropdown: [ dropdown: [
...AssetProtocols, ...AssetProtocols,
...ApplicationTypes ...ApplicationSystemUserTypes
] ]
} }
}, },

View File

@@ -11,6 +11,7 @@ export default {
HomeCard HomeCard
}, },
data() { data() {
const vm = this
return { return {
cardConfig: { cardConfig: {
title: this.$t('route.SessionOffline') title: this.$t('route.SessionOffline')
@@ -29,7 +30,11 @@ export default {
formatter: function(row, column, cellValue, index) { formatter: function(row, column, cellValue, index) {
const label = index + 1 const label = index + 1
const route = { to: { name: 'SessionDetail', params: { id: row.id }}} const route = { to: { name: 'SessionDetail', params: { id: row.id }}}
return <router-link {...{ attrs: route }}>{ label }</router-link> if (vm.$hasPerm('terminal.view_session')) {
return <router-link {...{ attrs: route }} >{ label }</router-link>
} else {
return label
}
} }
}, },
user: { user: {

View File

@@ -39,8 +39,8 @@ export default {
return 'AssetsTicketDetail' return 'AssetsTicketDetail'
} else if (row.type === 'apply_application') { } else if (row.type === 'apply_application') {
return 'AppsTicketDetail' return 'AppsTicketDetail'
} else if (row.type === 'login_asset_confirm') { } else if (row.type === 'login_asset_confirm' || row.type === 'login_confirm') {
return 'loginAssetTicketDetail' return 'LoginAssetTicketDetail'
} else if (row.type === 'command_confirm') { } else if (row.type === 'command_confirm') {
return 'CommandConfirmDetail' return 'CommandConfirmDetail'
} else { } else {

View File

@@ -86,7 +86,7 @@ export default {
this.$axios.patch( this.$axios.patch(
`/api/v1/notifications/system-msg-subscription/${sub.id}/`, `/api/v1/notifications/system-msg-subscription/${sub.id}/`,
{ receiveBackends: backends } { receive_backends: backends }
).catch(err => { ).catch(err => {
this.$log.error(err) this.$log.error(err)
}) })

View File

@@ -40,11 +40,13 @@ export default {
visible: false, visible: false,
iFormSetting: { iFormSetting: {
url: '/api/v1/terminal/terminals/', url: '/api/v1/terminal/terminals/',
getUrl: () => '/api/v1/terminal/terminals/',
fields: [ fields: [
['', ['command_storage', 'replay_storage']] ['', ['command_storage', 'replay_storage']]
], ],
fieldsMeta: { fieldsMeta: {
command_storage: { command_storage: {
label: this.$t('sessions.commandStorage'),
component: Select2, component: Select2,
el: { el: {
ajax: { ajax: {
@@ -54,6 +56,7 @@ export default {
} }
}, },
replay_storage: { replay_storage: {
label: this.$t('sessions.replayStorage'),
component: Select2, component: Select2,
el: { el: {
ajax: { ajax: {

View File

@@ -37,7 +37,7 @@
<el-button <el-button
type="danger" type="danger"
size="small" size="small"
:disabled="asDisabled(!session.can_terminate || !$hasPerm('terminal.terminate_session'))" :disabled="!session.can_terminate"
@click="onConnect" @click="onConnect"
> >
{{ $t('sessions.terminate') }} {{ $t('sessions.terminate') }}
@@ -45,7 +45,7 @@
<el-button <el-button
type="primary" type="primary"
size="small" size="small"
:disabled="asDisabled(!session.can_join || !$hasPerm('terminal.monitor_session'))" :disabled="!session.can_join"
@click="onMonitor" @click="onMonitor"
> >
{{ $t('sessions.Monitor') }} {{ $t('sessions.Monitor') }}
@@ -117,9 +117,6 @@ export default {
onMonitor() { onMonitor() {
const joinUrl = `/luna/monitor/${this.session.id}` const joinUrl = `/luna/monitor/${this.session.id}`
window.open(joinUrl, 'height=600, width=800, top=400, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no') window.open(joinUrl, 'height=600, width=800, top=400, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')
},
asDisabled(type) {
return (type || true) || !this.$hasPerm('tickets.view_ticket')
} }
} }

View File

@@ -31,6 +31,7 @@ export default {
return { return {
loading: true, loading: true,
relationConfig: { relationConfig: {
disabled: !this.$hasPerm('rbac.add_systemrolebinding'),
icon: 'fa-user', icon: 'fa-user',
title: this.$t('common.Members'), title: this.$t('common.Members'),
objectsAjax: { objectsAjax: {

View File

@@ -36,10 +36,10 @@ export default {
activeMenu: 'RoleInfo', activeMenu: 'RoleInfo',
actions: { actions: {
canDelete: () => { canDelete: () => {
return vm.hasPermNotBuiltinNotRootOrg(this.role, `rbac.delete_${scopeRole}`) return vm.hasPermNotBuiltin(this.role, `rbac.delete_${scopeRole}`)
}, },
canUpdate: () => { canUpdate: () => {
return vm.hasPermNotBuiltinNotRootOrg(this.role, `rbac.change_${scopeRole}`) return vm.hasPermNotBuiltin(this.role, `rbac.change_${scopeRole}`)
}, },
updateRoute: { updateRoute: {
name: this.$route.name.replace('Detail', 'Update'), name: this.$route.name.replace('Detail', 'Update'),
@@ -62,10 +62,8 @@ export default {
} }
}, },
methods: { methods: {
hasPermNotBuiltinNotRootOrg(row, perm) { hasPermNotBuiltin(row, perm) {
return !row['builtin'] && return !row['builtin'] && this.$hasPerm(perm)
this.$hasPerm(perm) &&
!this.$isRootOrg()
} }
} }
} }

View File

@@ -60,10 +60,10 @@ export default {
actions: { actions: {
formatterArgs: { formatterArgs: {
canUpdate: ({ row }) => { canUpdate: ({ row }) => {
return this.hasPermNotBuiltinNotRootOrg(row, `rbac.change_${row.scope}role`) return this.hasPermNotBuiltin(row, `rbac.change_${row.scope}role`)
}, },
canDelete: ({ row }) => { canDelete: ({ row }) => {
return this.hasPermNotBuiltinNotRootOrg(row, `rbac.delete_${row.scope}role`) return this.hasPermNotBuiltin(row, `rbac.delete_${row.scope}role`)
}, },
updateRoute: { updateRoute: {
name: 'RoleUpdate', name: 'RoleUpdate',
@@ -108,8 +108,8 @@ export default {
} }
}, },
methods: { methods: {
hasPermNotBuiltinNotRootOrg(row, perm) { hasPermNotBuiltin(row, perm) {
return !row['builtin'] && this.$hasPerm(perm) && !this.$isRootOrg() return !row['builtin'] && this.$hasPerm(perm)
} }
} }
} }

View File

@@ -116,7 +116,7 @@ export default {
} }
}, },
hidden: () => { hidden: () => {
return !this.$hasPerm('rbac.change_systemrolebinding') return !this.$hasPerm('rbac.add_systemrolebinding')
}, },
value: [] value: []
}, },
@@ -135,7 +135,7 @@ export default {
}, },
hidden: () => { hidden: () => {
return !this.$store.getters.hasValidLicense || return !this.$store.getters.hasValidLicense ||
!this.$hasPerm('rbac.change_orgrolebinding') || !this.$hasPerm('rbac.add_orgrolebinding') ||
this.$store.getters.currentOrgIsRoot this.$store.getters.currentOrgIsRoot
}, },
helpText: this.$t('users.HelpText.OrgRoleHelpText') helpText: this.$t('users.HelpText.OrgRoleHelpText')