mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-11 19:41:55 +00:00
perf: change diretory service account
This commit is contained in:
parent
bf687802d0
commit
5f1b71520f
@ -51,7 +51,7 @@
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { accountOtherActions, accountQuickFilters, connectivityMeta } from './const'
|
||||
import { accountOtherActions, accountQuickFilters, connectivityMeta, isDirectoryServiceAccount } from './const'
|
||||
import { openTaskPage } from '@/utils/jms'
|
||||
import {
|
||||
AccountConnectFormatter,
|
||||
@ -216,6 +216,7 @@ export default {
|
||||
width: '80px',
|
||||
formatter: AccountConnectFormatter,
|
||||
formatterArgs: {
|
||||
asset: this.asset,
|
||||
can: ({ row }) => {
|
||||
return this.currentUserIsSuperAdmin
|
||||
}
|
||||
@ -291,7 +292,7 @@ export default {
|
||||
hasUpdate: false, // can set function(row, value)
|
||||
hasDelete: true, // can set function(row, value)
|
||||
hasClone: false,
|
||||
canDelete: () => vm.$hasPerm('accounts.delete_account'),
|
||||
canDelete: ({ row }) => vm.$hasPerm('accounts.delete_account') && !isDirectoryServiceAccount(row, this),
|
||||
moreActionsTitle: this.$t('More'),
|
||||
extraActions: accountOtherActions(this)
|
||||
}
|
||||
|
@ -24,7 +24,12 @@ export const connectivityMeta = {
|
||||
width: '130px'
|
||||
}
|
||||
|
||||
export const accountOtherActions = (vm) => [
|
||||
export function isDirectoryServiceAccount(account, vm) {
|
||||
return vm.asset && vm.asset.id !== account.asset.id
|
||||
}
|
||||
|
||||
export const accountOtherActions = (vm) => {
|
||||
return [
|
||||
{
|
||||
name: 'View',
|
||||
title: vm.$t('View'),
|
||||
@ -44,7 +49,11 @@ export const accountOtherActions = (vm) => [
|
||||
{
|
||||
name: 'Update',
|
||||
title: vm.$t('Edit'),
|
||||
can: vm.$hasPerm('accounts.change_account') && !vm.$store.getters.currentOrgIsRoot,
|
||||
can: ({ row }) => {
|
||||
return vm.$hasPerm('accounts.change_account') &&
|
||||
!vm.$store.getters.currentOrgIsRoot &&
|
||||
!isDirectoryServiceAccount(row, vm)
|
||||
},
|
||||
callback: ({ row }) => {
|
||||
vm.isUpdateAccount = true
|
||||
const data = {
|
||||
@ -63,7 +72,11 @@ export const accountOtherActions = (vm) => [
|
||||
{
|
||||
name: 'UpdateSecret',
|
||||
title: vm.$t('EditSecret'),
|
||||
can: vm.$hasPerm('accounts.change_account') && !vm.$store.getters.currentOrgIsRoot,
|
||||
can: ({ row }) => {
|
||||
return vm.$hasPerm('accounts.change_account') &&
|
||||
!vm.$store.getters.currentOrgIsRoot &&
|
||||
!isDirectoryServiceAccount(row, vm)
|
||||
},
|
||||
callback: ({ row }) => {
|
||||
const data = {
|
||||
...vm.asset,
|
||||
@ -84,7 +97,11 @@ export const accountOtherActions = (vm) => [
|
||||
has: () => {
|
||||
return !vm.asset
|
||||
},
|
||||
can: vm.$hasPerm('accounts.add_account') && !vm.$store.getters.currentOrgIsRoot,
|
||||
can: ({ row }) => {
|
||||
return vm.$hasPerm('accounts.add_account') &&
|
||||
!vm.$store.getters.currentOrgIsRoot &&
|
||||
!isDirectoryServiceAccount(row, vm)
|
||||
},
|
||||
callback: ({ row }) => {
|
||||
vm.account = {
|
||||
name: `${row.name} - ${vm.$t('Duplicate').toLowerCase()}`,
|
||||
@ -120,7 +137,10 @@ export const accountOtherActions = (vm) => [
|
||||
{
|
||||
name: 'ClearSecret',
|
||||
title: vm.$t('ClearSecret'),
|
||||
can: vm.$hasPerm('accounts.change_account'),
|
||||
can: ({ row }) => {
|
||||
return vm.$hasPerm('accounts.change_account') &&
|
||||
!isDirectoryServiceAccount(row, vm)
|
||||
},
|
||||
type: 'primary',
|
||||
callback: ({ row }) => {
|
||||
vm.$axios.patch(
|
||||
@ -151,7 +171,11 @@ export const accountOtherActions = (vm) => [
|
||||
title: vm.$t('CopyToAsset'),
|
||||
type: 'primary',
|
||||
divided: true,
|
||||
can: () => vm.$hasPerm('accounts.add_account') && !vm.$store.getters.currentOrgIsRoot,
|
||||
can: ({ row }) => {
|
||||
return vm.$hasPerm('accounts.add_account') &&
|
||||
!vm.$store.getters.currentOrgIsRoot &&
|
||||
!isDirectoryServiceAccount(row, vm)
|
||||
},
|
||||
has: () => {
|
||||
return !vm.asset
|
||||
},
|
||||
@ -167,7 +191,11 @@ export const accountOtherActions = (vm) => [
|
||||
name: 'MoveToOther',
|
||||
title: vm.$t('MoveToAsset'),
|
||||
type: 'primary',
|
||||
can: () => vm.$hasPerm('accounts.add_account') && !vm.$store.getters.currentOrgIsRoot,
|
||||
can: ({ row }) => {
|
||||
return vm.$hasPerm('accounts.add_account') &&
|
||||
!vm.$store.getters.currentOrgIsRoot &&
|
||||
!isDirectoryServiceAccount(row, vm)
|
||||
},
|
||||
has: () => {
|
||||
return !vm.asset
|
||||
},
|
||||
@ -180,6 +208,7 @@ export const accountOtherActions = (vm) => [
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
export const accountQuickFilters = (vm) => [
|
||||
{
|
||||
|
@ -54,13 +54,15 @@ export default {
|
||||
default() {
|
||||
return {
|
||||
can: () => true,
|
||||
getConnectUrl: (row, protocol) => {
|
||||
getConnectUrl: (row, protocol, asset) => {
|
||||
const assetId = asset ? asset.id : row.asset.id
|
||||
return `/luna/admin-connect/?
|
||||
asset=${row.asset.id}
|
||||
asset=${assetId}
|
||||
&account=${row.id}
|
||||
&protocol=${protocol}
|
||||
`.replace(/\s+/g, '')
|
||||
},
|
||||
asset: null,
|
||||
assetUrl: '/api/v1/assets/assets/{id}/',
|
||||
buttonIcon: 'fa fa-desktop'
|
||||
}
|
||||
@ -86,7 +88,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
handleProtocolConnect(protocol) {
|
||||
const url = this.formatterArgs.getConnectUrl(this.row, protocol)
|
||||
const url = this.formatterArgs.getConnectUrl(this.row, protocol, this.formatterArgs.asset)
|
||||
window.open(url, '_blank')
|
||||
},
|
||||
visibleChange(visible) {
|
||||
|
@ -72,7 +72,6 @@ export const interval = {
|
||||
],
|
||||
on: {
|
||||
input: (val, updateForm) => {
|
||||
console.log('interval input', val)
|
||||
updateForm({
|
||||
crontab: ''
|
||||
})
|
||||
|
@ -64,7 +64,7 @@ export default {
|
||||
[this.$t('Basic'), ['name', 'address', 'platform', 'nodes']],
|
||||
[this.$t('Protocol'), ['protocols']],
|
||||
[this.$t('Account'), ['accounts']],
|
||||
[this.$t('Other'), ['domain', 'labels', 'is_active', 'comment']]
|
||||
[this.$t('Other'), ['directory_services', 'domain', 'labels', 'is_active', 'comment']]
|
||||
],
|
||||
fieldsMeta: {},
|
||||
performSubmit(validValues) {
|
||||
|
@ -50,7 +50,7 @@ export default {
|
||||
]],
|
||||
[this.$t('Config'), [
|
||||
'protocols', 'su_enabled', 'su_method',
|
||||
'domain_enabled', 'ds_enabled', 'ds',
|
||||
'domain_enabled', 'ds_enabled',
|
||||
'charset'
|
||||
]],
|
||||
[this.$t('Automations'), ['automation']],
|
||||
|
@ -86,14 +86,7 @@ export const platformFieldsMeta = (vm) => {
|
||||
disabled: false
|
||||
}
|
||||
},
|
||||
ds: {
|
||||
el: {
|
||||
multiple: false,
|
||||
url: '/api/v1/assets/directories/',
|
||||
disabled: false
|
||||
},
|
||||
hidden: (formValue) => !formValue['ds_enabled']
|
||||
},
|
||||
|
||||
protocols: {
|
||||
label: i18n.t('SupportedProtocol'),
|
||||
...assetMeta.protocols,
|
||||
|
@ -133,6 +133,15 @@ export const assetFieldsMeta = (vm, category, type) => {
|
||||
default: []
|
||||
}
|
||||
},
|
||||
directory_services: {
|
||||
el: {
|
||||
url: '/api/v1/assets/directories/',
|
||||
disabled: false
|
||||
},
|
||||
hidden: () => {
|
||||
return vm.platform.ds_enabled === false
|
||||
}
|
||||
},
|
||||
nodes: {
|
||||
rules: [rules.RequiredChange],
|
||||
el: {
|
||||
|
Loading…
Reference in New Issue
Block a user