fix: 修复录像、命令存储权限控制

This commit is contained in:
Jiangjie.Bai
2022-03-15 15:41:23 +08:00
committed by Jiangjie.Bai
parent b89fca2af0
commit eb8a24a23f
2 changed files with 11 additions and 4 deletions

View File

@@ -68,13 +68,13 @@ export default {
prop: 'id',
formatterArgs: {
canUpdate: function({ row }) {
return (row.name !== 'default' && row.name !== 'null')
return (row.name !== 'default' && row.name !== 'null' && vm.$hasPerm('terminal.change_commandstorage'))
},
onUpdate: function({ row }) {
this.$router.push({ name: 'CommandStorageUpdate', params: { id: row.id }})
},
canDelete: function({ row }) {
return (row.name !== 'default' && row.name !== 'null')
return (row.name !== 'default' && row.name !== 'null' && vm.$hasPerm('terminal.delete_commandstorage'))
},
hasClone: false,
extraActions: [
@@ -82,6 +82,7 @@ export default {
name: 'test',
title: this.$t('sessions.test'),
type: 'primary',
can: vm.$hasPerm('terminal.change_commandstorage'),
callback: function({ row, col, cellValue, reload }) {
TestCommandStorage(row.id).then(data => {
if (!data['is_valid']) {
@@ -96,6 +97,7 @@ export default {
name: 'set_to_default',
title: this.$t('sessions.SetToDefault'),
type: 'primary',
can: vm.$hasPerm('terminal.change_commandstorage'),
callback: function({ row, col, cellValue, reload }) {
SetToDefaultCommandStorage(row.id).then(data => {
vm.$refs.ListTable.reloadTable()

View File

@@ -29,6 +29,7 @@ export default {
replayTableConfig: {
url: '/api/v1/terminal/replay-storages/',
permissions: {
app: 'terminal',
resource: 'replaystorage'
},
columns: ['name', 'type', 'comment', 'is_default', 'actions'],
@@ -60,16 +61,19 @@ export default {
this.$router.push({ name: 'ReplayStorageUpdate', params: { id: row.id }, query: { type: row.type }})
},
canUpdate: function({ row }) {
return (row.name !== 'default' && row.name !== 'null')
return (
row.name !== 'default' && row.name !== 'null' && vm.$hasPerm('terminal.change_replaystorage')
)
},
canDelete: function({ row }) {
return (row.name !== 'default' && row.name !== 'null')
return (row.name !== 'default' && row.name !== 'null' && vm.$hasPerm('terminal.delete_replaystorage'))
},
hasClone: false,
extraActions: [
{
name: 'test',
title: this.$t('sessions.test'),
can: vm.$hasPerm('terminal.change_replaystorage'),
type: 'primary',
callback: function({ row, col, cellValue, reload }) {
TestReplayStorage(row.id).then(data => {
@@ -84,6 +88,7 @@ export default {
{
name: 'set_to_default',
title: this.$t('sessions.SetToDefault'),
can: this.$hasPerm('terminal.change_replaystorage'),
type: 'primary',
callback: function({ row, col, cellValue, reload }) {
SetToDefaultReplayStorage(row.id).then(data => {