Merge branch 'pam' of github.com:jumpserver/lina into pam

This commit is contained in:
ibuler
2025-01-20 19:34:34 +08:00
7 changed files with 73 additions and 54 deletions

View File

@@ -6,8 +6,6 @@ import AutomationParamsForm from '@/views/assets/Platform/AutomationParamsSettin
export const accountFieldsMeta = (vm) => {
const defaultPrivilegedAccounts = ['root', 'administrator']
const isPam = vm.$route.query.flag === 'copy' || vm.$route.query.flag === 'move'
return {
assets: {
component: Select2,
@@ -30,7 +28,9 @@ export const accountFieldsMeta = (vm) => {
component: Select2,
rules: [Required],
el: {
disabled: isPam,
get disabled() {
return vm.isDisabled
},
multiple: false,
ajax: {
url: '/api/v1/accounts/account-templates/',
@@ -48,7 +48,9 @@ export const accountFieldsMeta = (vm) => {
label: vm.$t('AccountPolicy'),
helpTip: vm.$t('AccountPolicyHelpText'),
el: {
disabled: isPam
get disabled() {
return vm.isDisabled
}
},
hidden: () => {
return vm.platform || vm.asset
@@ -58,7 +60,9 @@ export const accountFieldsMeta = (vm) => {
label: vm.$t('Name'),
rules: [RequiredChange],
el: {
disabled: isPam
get disabled() {
return vm.isDisabled
}
},
on: {
input: ([value], updateForm) => {
@@ -79,7 +83,9 @@ export const accountFieldsMeta = (vm) => {
},
username: {
el: {
disabled: !!vm.account?.name || isPam
get disabled() {
return !!vm.account?.name || vm.isDisabled
}
},
on: {
input: ([value], updateForm) => {
@@ -99,7 +105,9 @@ export const accountFieldsMeta = (vm) => {
privileged: {
label: vm.$t('Privileged'),
el: {
disabled: isPam
get disabled() {
return vm.isDisabled
}
},
hidden: () => {
return vm.addTemplate
@@ -113,7 +121,11 @@ export const accountFieldsMeta = (vm) => {
el: {
multiple: false,
clearable: true,
disabled: isPam,
disabled: {
get disabled() {
return vm.isDisabled
}
},
ajax: {
url: `/api/v1/accounts/accounts/su-from-accounts/?account=${vm.account?.id || ''}&asset=${vm.asset?.id || ''}`,
transformOption: (item) => {
@@ -124,7 +136,11 @@ export const accountFieldsMeta = (vm) => {
},
su_from_username: {
label: vm.$t('UserSwitchFrom'),
disabled: isPam,
el: {
get disabled() {
return vm.isDisabled
}
},
hidden: (formValue) => {
return vm.platform || vm.asset || vm.addTemplate
}
@@ -133,7 +149,9 @@ export const accountFieldsMeta = (vm) => {
label: vm.$t('Password'),
component: UpdateToken,
el: {
disabled: isPam
get disabled() {
return vm.isDisabled
}
},
hidden: (formValue) => {
return formValue.secret_type !== 'password' || vm.addTemplate
@@ -143,7 +161,9 @@ export const accountFieldsMeta = (vm) => {
label: vm.$t('PrivateKey'),
component: UploadSecret,
el: {
disabled: isPam
get disabled() {
return vm.isDisabled
}
},
hidden: (formValue) => formValue.secret_type !== 'ssh_key' || vm.addTemplate
},
@@ -151,7 +171,9 @@ export const accountFieldsMeta = (vm) => {
label: vm.$t('Passphrase'),
component: UpdateToken,
el: {
disabled: isPam
get disabled() {
return vm.isDisabled
}
},
hidden: (formValue) => formValue.secret_type !== 'ssh_key' || vm.addTemplate
},
@@ -159,7 +181,9 @@ export const accountFieldsMeta = (vm) => {
label: vm.$t('Token'),
component: UploadSecret,
el: {
disabled: isPam
get disabled() {
return vm.isDisabled
}
},
hidden: (formValue) => formValue.secret_type !== 'token' || vm.addTemplate
},
@@ -168,7 +192,9 @@ export const accountFieldsMeta = (vm) => {
label: vm.$t('AccessKey'),
component: UploadSecret,
el: {
disabled: isPam
get disabled() {
return vm.isDisabled
}
},
hidden: (formValue) => formValue.secret_type !== 'access_key' || vm.addTemplate
},
@@ -177,7 +203,9 @@ export const accountFieldsMeta = (vm) => {
label: vm.$t('ApiKey'),
component: UploadSecret,
el: {
disabled: isPam
get disabled() {
return vm.isDisabled
}
},
hidden: (formValue) => formValue.secret_type !== 'api_key' || vm.addTemplate
},
@@ -185,7 +213,9 @@ export const accountFieldsMeta = (vm) => {
type: 'radio-group',
options: [],
el: {
disabled: isPam
get disabled() {
return vm.isDisabled
}
},
hidden: () => {
return vm.addTemplate
@@ -223,19 +253,25 @@ export const accountFieldsMeta = (vm) => {
is_active: {
label: vm.$t('IsActive'),
el: {
disabled: isPam
get disabled() {
return vm.isDisabled
}
}
},
comment: {
label: vm.$t('Comment'),
el: {
disabled: isPam
get disabled() {
return vm.isDisabled
}
}
},
secret_reset: {
label: vm.$t('SecretReset'),
el: {
disabled: isPam
get disabled() {
return vm.isDisabled
}
}
}
}

View File

@@ -45,6 +45,7 @@ export default {
data() {
return {
loading: true,
isDisabled: false,
usernameChanged: false,
submitBtnText: this.$t('Confirm'),
iPlatform: {
@@ -74,6 +75,16 @@ export default {
hasSaveContinue: false
}
},
watch: {
'$route.query': {
handler(nv, ov) {
if (nv && (nv.flag === 'move' || nv.flag === 'copy')) {
this.isDisabled = true
}
},
immediate: true
}
},
async mounted() {
try {
await this.getPlatform()

View File

@@ -99,7 +99,3 @@ export default {
}
}
</script>
<style scoped>
</style>

View File

@@ -100,8 +100,6 @@ export default {
data() {
const vm = this
return {
showDrawer: false,
dynamicTemplateComponent: null,
defaultMoreActions: [
{
title: this.$t('DeleteSelected'),
@@ -231,20 +229,9 @@ export default {
const { href } = this.$router.resolve(route)
window.open(href, '_blank')
} else {
if (route.isPam) {
this.showDrawer = true
this.dynamicTemplateComponent = route.name
return
}
this.$router.push(route)
}
},
handleCloseDrawer() {
this.showDrawer = false
this.dynamicTemplateComponent = null
},
defaultBulkDeleteCallback({ selectedRows, reloadTable }) {
const msg = this.$t('DeleteWarningMsg') + ' ' + selectedRows.length + ' ' + this.$t('Rows') + ' ?'
const title = this.$tc('Info')
@@ -285,15 +272,4 @@ export default {
</script>
<style lang="scss" scoped>
::v-deep .ibox {
height: 100% !important;
margin: unset !important;
border: unset !important;
.el-card__body {
padding-top: unset !important;
padding-bottom: unset !important;
height: 100% !important;
}
}
</style>

View File

@@ -13,7 +13,7 @@ export default [
app: 'accounts',
name: 'BaseAccountRisk',
icon: 'scan',
resource: 'accountcheckautomation'
resource: 'checkaccountautomation'
},
children: [
{

View File

@@ -9,7 +9,7 @@ import { GenericListTable } from '@/layout/components'
import AmountFormatter from '@/components/Table/TableFormatters/AmountFormatter.vue'
export default {
name: 'AccountPushList',
name: 'AccountCheckTaskList',
components: {
GenericListTable
},
@@ -115,7 +115,7 @@ export default {
type: 'primary',
name: 'execute',
can: ({ row }) => {
return row.is_active && vm.$hasPerm('accounts.add_accountcheckautomation')
return row.is_active && vm.$hasPerm('accounts.add_checkaccountautomation')
},
callback: function({ row }) {
this.$axios.post(
@@ -139,7 +139,7 @@ export default {
hasExport: false,
hasImport: false,
createRoute: 'AccountCheckCreateUpdate',
canCreate: vm.$hasPerm('accounts.add_accountcheckautomation')
canCreate: vm.$hasPerm('accounts.add_checkaccountautomation')
}
}
}

View File

@@ -24,19 +24,19 @@ export default {
{
title: this.$t('DetectTasks'),
name: 'AccountCheckTask',
hidden: !this.$hasPerm('accounts.view_accountcheckautomation'),
hidden: !this.$hasPerm('accounts.view_checkaccountautomation'),
component: () => import('./AccountCheckTaskList.vue')
},
{
title: this.$t('Executions'),
name: 'AccountCheckExecution',
hidden: !this.$hasPerm('accounts.view_accountcheckautomation'),
hidden: !this.$hasPerm('accounts.view_checkaccountautomation'),
component: () => import('./AccountCheckExecutionList.vue')
},
{
title: this.$t('DetectEngines'),
name: 'AccountCheckEngine',
hidden: !this.$hasPerm('accounts.view_accountcheckautomation'),
hidden: !this.$hasPerm('accounts.view_checkaccountautomation'),
component: () => import('@/views/pam/RiskDetect/AccountCheckEngine.vue')
}
]