diff --git a/src/App.vue b/src/App.vue
index f558a2ee0..6777688f2 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -45,7 +45,6 @@ export default {
},
methods: {
createWatermark() {
- console.log('currentUser', this.currentUser)
if (this.currentUser?.username && this.publicSettings?.SECURITY_WATERMARK_ENABLED) {
this.watermark = new Watermark({
content: `${this.currentUser.username}(${this.currentUser.name})`,
@@ -53,7 +52,7 @@ export default {
height: 200,
rotate: 45,
fontWeight: 'normal',
- fontColor: 'rgba(128, 128, 128, 0.3)'
+ fontColor: 'rgba(128, 128, 128, 0.2)'
})
this.watermark.create()
diff --git a/src/components/Apps/AccountCreateUpdateForm/const.js b/src/components/Apps/AccountCreateUpdateForm/const.js
index e320c9c06..3affbde3e 100644
--- a/src/components/Apps/AccountCreateUpdateForm/const.js
+++ b/src/components/Apps/AccountCreateUpdateForm/const.js
@@ -6,6 +6,13 @@ import AutomationParamsForm from '@/views/assets/Platform/AutomationParamsSettin
export const accountFieldsMeta = (vm) => {
const defaultPrivilegedAccounts = ['root', 'administrator']
+ function onPrivilegedUser(value, updateForm) {
+ const maybePrivileged = defaultPrivilegedAccounts.includes(value)
+ if (maybePrivileged) {
+ updateForm({ privileged: true, secret_reset: false, push_now: false })
+ }
+ }
+
return {
assets: {
component: Select2,
@@ -70,11 +77,8 @@ export const accountFieldsMeta = (vm) => {
if (!vm.account?.name) {
updateForm({ username: value })
}
- const maybePrivileged = defaultPrivilegedAccounts.includes(value)
- if (maybePrivileged) {
- updateForm({ privileged: true })
- }
}
+ onPrivilegedUser(value, updateForm)
}
},
hidden: () => {
@@ -92,10 +96,7 @@ export const accountFieldsMeta = (vm) => {
vm.usernameChanged = true
},
change: ([value], updateForm) => {
- const maybePrivileged = defaultPrivilegedAccounts.includes(value)
- if (maybePrivileged) {
- updateForm({ privileged: true })
- }
+ onPrivilegedUser(value, updateForm)
}
},
hidden: () => {
diff --git a/src/components/Apps/AccountListTable/AccountList.vue b/src/components/Apps/AccountListTable/AccountList.vue
index 191b777d4..1220d33f6 100644
--- a/src/components/Apps/AccountListTable/AccountList.vue
+++ b/src/components/Apps/AccountListTable/AccountList.vue
@@ -147,6 +147,10 @@ export default {
showActions: {
type: Boolean,
default: true
+ },
+ target: {
+ type: Object,
+ default: null
}
},
data() {
@@ -182,7 +186,7 @@ export default {
},
columnsMeta: {
name: {
- width: '120px',
+ minWidth: '120px',
formatterArgs: {
can: () => vm.$hasPerm('accounts.view_account'),
getRoute: ({ row }) => ({
@@ -234,7 +238,14 @@ export default {
}
},
username: {
- width: '120px'
+ minWidth: '120px',
+ formatter: function(row) {
+ if (row.ad_domain) {
+ return `${row.username}@${row.ad_domain}`
+ } else {
+ return row.username
+ }
+ }
},
secret_type: {
formatter: function(row) {
diff --git a/src/components/Table/TableFormatters/AccountInfoFormatter.vue b/src/components/Table/TableFormatters/AccountInfoFormatter.vue
index f1204c926..ad0dad1af 100644
--- a/src/components/Table/TableFormatters/AccountInfoFormatter.vue
+++ b/src/components/Table/TableFormatters/AccountInfoFormatter.vue
@@ -10,7 +10,7 @@
{{ $t('No accounts') }}
- {{ account.name }}({{ account.username }})
+ {{ getDisplay(account) }}
@@ -39,10 +39,20 @@ export default {
}
},
methods: {
+ getDisplay(account) {
+ const { username, name } = account
+ if (username.startsWith('@')) {
+ return name
+ } else if (name === username) {
+ return username
+ } else {
+ return `${name}(${username})`
+ }
+ },
async getAsyncItems() {
this.loading = true
const userId = this.$route.params.id || 'self'
- const url = `/api/v1/perms/users/${userId}/assets/${this.row.id}`
+ const url = `/api/v1/perms/users/${userId}/assets/${this.row.id}/`
this.$axios.get(url).then(res => {
this.accountData = res?.permed_accounts || []
}).finally(() => {
diff --git a/src/store/modules/assets.js b/src/store/modules/assets.js
index 360cff4fe..0e772705f 100644
--- a/src/store/modules/assets.js
+++ b/src/store/modules/assets.js
@@ -89,6 +89,9 @@ const actions = {
})
})
},
+ cleanPlatforms({ commit, dispatch, state }) {
+ state.platforms = []
+ },
addToRecentPlatforms({ commit, display, state }, platform) {
const recentPlatformIds = state.recentPlatformIds.filter(i => i !== platform.id)
recentPlatformIds.unshift(platform.id)
diff --git a/src/views/assets/Asset/AssetCreateUpdate/ADCreateUpdate.vue b/src/views/assets/Asset/AssetCreateUpdate/ADCreateUpdate.vue
new file mode 100644
index 000000000..cfb370955
--- /dev/null
+++ b/src/views/assets/Asset/AssetCreateUpdate/ADCreateUpdate.vue
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
diff --git a/src/views/assets/Asset/AssetDetail/Account.vue b/src/views/assets/Asset/AssetDetail/Account.vue
index 6a61b6164..82260865e 100644
--- a/src/views/assets/Asset/AssetDetail/Account.vue
+++ b/src/views/assets/Asset/AssetDetail/Account.vue
@@ -59,7 +59,7 @@ export default {
return {
title: this.$t('Test'),
templateDialogVisible: false,
- columnsDefault: ['name', 'username', 'asset', 'connect'],
+ columnsDefault: ['name', 'username', 'connect'],
headerExtraActions: [
{
name: this.$t('AccountTemplate'),
@@ -96,7 +96,7 @@ export default {
},
computed: {
iUrl() {
- return this.url || `/api/v1/accounts/accounts/?asset=${this.object.id}`
+ return this.url || `/api/v1/assets/assets/${this.object.id}/accounts/`
}
},
methods: {
diff --git a/src/views/assets/Asset/AssetList/ADList.vue b/src/views/assets/Asset/AssetList/ADList.vue
new file mode 100644
index 000000000..c9365bae1
--- /dev/null
+++ b/src/views/assets/Asset/AssetList/ADList.vue
@@ -0,0 +1,21 @@
+
+
+
+
+
diff --git a/src/views/assets/Asset/AssetList/components/BaseList.vue b/src/views/assets/Asset/AssetList/components/BaseList.vue
index 6be5f7876..f5aab55fa 100644
--- a/src/views/assets/Asset/AssetList/components/BaseList.vue
+++ b/src/views/assets/Asset/AssetList/components/BaseList.vue
@@ -143,7 +143,8 @@ export default {
'custom': () => import('@/views/assets/Asset/AssetCreateUpdate/CustomCreateUpdate.vue'),
'cloud': () => import('@/views/assets/Asset/AssetCreateUpdate/CloudCreateUpdate.vue'),
'device': () => import('@/views/assets/Asset/AssetCreateUpdate/DeviceCreateUpdate.vue'),
- 'database': () => import('@/views/assets/Asset/AssetCreateUpdate/DatabaseCreateUpdate.vue')
+ 'database': () => import('@/views/assets/Asset/AssetCreateUpdate/DatabaseCreateUpdate.vue'),
+ 'ad': () => import('@/views/assets/Asset/AssetCreateUpdate/ADCreateUpdate.vue')
},
createProps: {},
showPlatform: false,
diff --git a/src/views/assets/Asset/AssetList/components/PlatformDialog.vue b/src/views/assets/Asset/AssetList/components/PlatformDialog.vue
index bad249702..9c01c3dfc 100644
--- a/src/views/assets/Asset/AssetList/components/PlatformDialog.vue
+++ b/src/views/assets/Asset/AssetList/components/PlatformDialog.vue
@@ -76,7 +76,7 @@ export default {
platforms: [],
recentPlatformIds: [],
loading: true,
- activeType: 'host',
+ activeType: [],
recentUsedLabel: this.$t('RecentlyUsed'),
typeIconMapper: {
linux: 'fa-linux',
@@ -130,9 +130,7 @@ export default {
async created() {
this.platforms = await this.$store.dispatch('assets/getPlatforms')
this.allRecentPlatforms = await this.$store.dispatch('assets/getRecentPlatforms')
- if (this.allRecentPlatforms.length > 0) {
- this.activeType = this.recentUsedLabel
- }
+ this.activeType = Object.keys(this.iPlatforms)[0]
this.loading = false
},
methods: {
diff --git a/src/views/assets/Asset/AssetList/index.vue b/src/views/assets/Asset/AssetList/index.vue
index c8ccada5d..ee3dbb001 100644
--- a/src/views/assets/Asset/AssetList/index.vue
+++ b/src/views/assets/Asset/AssetList/index.vue
@@ -56,6 +56,12 @@ export default {
hidden: true,
component: () => import('@/views/assets/Asset/AssetList/WebList.vue')
},
+ {
+ icon: 'fa-comment',
+ name: 'ad',
+ hidden: true,
+ component: () => import('@/views/assets/Asset/AssetList/ADList.vue')
+ },
{
icon: 'fa-comment',
name: 'gpt',
diff --git a/src/views/assets/Platform/PlatformCreateUpdate.vue b/src/views/assets/Platform/PlatformCreateUpdate.vue
index 03fe74e6f..008b3363c 100644
--- a/src/views/assets/Platform/PlatformCreateUpdate.vue
+++ b/src/views/assets/Platform/PlatformCreateUpdate.vue
@@ -11,6 +11,7 @@
:has-reset="false"
:initial="initial"
:url="url"
+ @submitSuccess="onSubmitSuccess"
/>
@@ -49,7 +50,8 @@ export default {
]],
[this.$t('Config'), [
'protocols', 'su_enabled', 'su_method',
- 'domain_enabled', 'charset'
+ 'domain_enabled', 'ad_enabled', 'ad',
+ 'charset'
]],
[this.$t('Automations'), ['automation']],
[this.$t('Other'), ['comment']]
@@ -105,6 +107,9 @@ export default {
}
},
methods: {
+ onSubmitSuccess() {
+ this.$store.dispatch('assets/cleanPlatforms')
+ },
updateSuMethodOptions() {
const options = this.suMethods.filter(i => {
return this.suMethodLimits.includes(i.value)
@@ -141,7 +146,6 @@ export default {
const constraints = await this.$axios.get(url)
this.defaultOptions = constraints
- const fieldsCheck = ['domain_enabled', 'su_enabled']
let protocols = constraints?.protocols || []
protocols = protocols?.map(i => {
if (i.name === 'http') {
@@ -151,6 +155,7 @@ export default {
})
this.fieldsMeta.protocols.el.choices = protocols
+ const fieldsCheck = ['domain_enabled', 'su_enabled', 'ad_enabled']
for (const field of fieldsCheck) {
const disabled = constraints[field] === false
this.initial[field] = !disabled
diff --git a/src/views/assets/Platform/PlatformList.vue b/src/views/assets/Platform/PlatformList.vue
index b4e168a7f..7c68de1cd 100644
--- a/src/views/assets/Platform/PlatformList.vue
+++ b/src/views/assets/Platform/PlatformList.vue
@@ -149,14 +149,7 @@ export default {
return `/api/v1/assets/platforms/?category=${this.tab.activeMenu}`
}
},
- deactivated() {
- window.localStorage.setItem('lastTab', this.tab.activeMenu)
- },
activated() {
- setTimeout(() => {
- this.tab.activeMenu = window.localStorage.getItem('lastTab') || 'host'
- this.$refs.genericListTable?.reloadTable()
- }, 300)
},
async mounted() {
try {
@@ -173,9 +166,19 @@ export default {
this.tableConfig.url = this.url
this.headerActions.importOptions.url = this.url
this.headerActions.exportOptions.url = this.url
- this.headerActions.moreCreates.dropdown = this.$store.state.assets.assetCategoriesDropdown.filter(item => {
+ const types = this.$store.state.assets.assetCategoriesDropdown.filter(item => {
return item.category === this.tab.activeMenu
+ }).map(item => {
+ if (!item.group) {
+ return item
+ } else {
+ return {
+ ...item,
+ group: item.group + this.$t('WordSep') + this.$t('Type')
+ }
+ }
})
+ this.headerActions.moreCreates.dropdown = types
},
async setCategoriesTab() {
const categoryIcon = {
@@ -185,6 +188,7 @@ export default {
cloud: 'fa-cloud',
web: 'fa-globe',
gpt: 'fa-comment',
+ ad: 'fa-comment',
custom: 'fa-cube'
}
const state = await this.$store.dispatch('assets/getAssetCategories')
diff --git a/src/views/assets/Platform/const.js b/src/views/assets/Platform/const.js
index f71cc94ff..b1f0250b8 100644
--- a/src/views/assets/Platform/const.js
+++ b/src/views/assets/Platform/const.js
@@ -81,6 +81,19 @@ export const platformFieldsMeta = (vm) => {
disabled: false
}
},
+ ad_enabled: {
+ el: {
+ disabled: false
+ }
+ },
+ ad: {
+ el: {
+ multiple: false,
+ url: '/api/v1/assets/directories/',
+ disabled: false
+ },
+ hidden: (formValue) => !formValue['ad_enabled']
+ },
protocols: {
label: i18n.t('SupportedProtocol'),
...assetMeta.protocols,