Compare commits

...

12 Commits

Author SHA1 Message Date
“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
13 changed files with 55 additions and 37 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"

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

@@ -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

@@ -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')