fix: 修复权限认证问题 (#482)

* fix: 修复权限认证问题

* fix: 修复权限认证问题

Co-authored-by: Orange <orangemtony@gmail.com>
This commit is contained in:
fit2bot 2020-11-05 18:59:08 +08:00 committed by GitHub
parent 09075b13b7
commit c0d3fbb47a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 24 deletions

View File

@ -35,7 +35,7 @@ const ApplicationPermissionRoutes = [
{ {
path: 'app-permissions', path: 'app-permissions',
component: empty, component: empty,
meta: { title: i18n.t('route.ApplicationPermission'), licenseRequired: true }, meta: { title: i18n.t('route.ApplicationPermission') },
redirect: '', redirect: '',
children: [ children: [
{ {

View File

@ -62,28 +62,28 @@ export default {
name: 'MySQL', name: 'MySQL',
title: 'MySQL', title: 'MySQL',
type: 'primary', type: 'primary',
can: true, has: true,
callback: this.createMysql.bind(this) callback: this.createMysql.bind(this)
}, },
{ {
name: 'PostgreSQL', name: 'PostgreSQL',
title: 'PostgreSQL', title: 'PostgreSQL',
type: 'primary', type: 'primary',
can: this.isValidateLicense, has: this.isValidateLicense,
callback: this.createPostgreSQL.bind(this) callback: this.createPostgreSQL.bind(this)
}, },
{ {
name: 'MariaDB', name: 'MariaDB',
title: 'MariaDB', title: 'MariaDB',
type: 'primary', type: 'primary',
can: this.isValidateLicense, has: this.isValidateLicense,
callback: this.createMariaDB.bind(this) callback: this.createMariaDB.bind(this)
}, },
{ {
name: 'Oracle', name: 'Oracle',
title: 'Oracle', title: 'Oracle',
type: 'primary', type: 'primary',
can: this.isValidateLicense, has: this.isValidateLicense,
callback: this.createOracle.bind(this) callback: this.createOracle.bind(this)
} }
] ]
@ -91,13 +91,7 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters(['publicSettings', 'currentOrg']), ...mapGetters(['publicSettings', 'currentOrg'])
isValidateLicense() {
if (this.publicSettings.XPACK_ENABLED) {
return this.publicSettings.XPACK_LICENSE_IS_VALID
}
return true
}
}, },
methods: { methods: {
createMysql() { createMysql() {
@ -111,6 +105,12 @@ export default {
}, },
createOracle() { createOracle() {
this.$router.push({ name: 'DatabaseAppCreate', query: { type: 'oracle' }}) this.$router.push({ name: 'DatabaseAppCreate', query: { type: 'oracle' }})
},
isValidateLicense() {
if (this.publicSettings.XPACK_ENABLED) {
return this.publicSettings.XPACK_LICENSE_IS_VALID
}
return false
} }
} }
} }

View File

@ -11,7 +11,7 @@ function isValidateLicense() {
if (store.getters.publicSettings.XPACK_ENABLED) { if (store.getters.publicSettings.XPACK_ENABLED) {
return store.getters.publicSettings.XPACK_LICENSE_IS_VALID return store.getters.publicSettings.XPACK_LICENSE_IS_VALID
} }
return true return false
} }
export const REMOTE_APP = [ export const REMOTE_APP = [
@ -19,28 +19,28 @@ export const REMOTE_APP = [
name: CHROME, name: CHROME,
title: i18n.t(`applications.applicationsType.${CHROME}`), title: i18n.t(`applications.applicationsType.${CHROME}`),
type: 'primary', type: 'primary',
can: isValidateLicense, has: isValidateLicense,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: CHROME, category: REMOTEAPP_CATEGORY }}) } callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: CHROME, category: REMOTEAPP_CATEGORY }}) }
}, },
{ {
name: MYSQL_WORKBENCH, name: MYSQL_WORKBENCH,
title: i18n.t(`applications.applicationsType.${MYSQL_WORKBENCH}`), title: i18n.t(`applications.applicationsType.${MYSQL_WORKBENCH}`),
type: 'primary', type: 'primary',
can: isValidateLicense, has: isValidateLicense,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: MYSQL_WORKBENCH, category: REMOTEAPP_CATEGORY }}) } callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: MYSQL_WORKBENCH, category: REMOTEAPP_CATEGORY }}) }
}, },
{ {
name: VMWARE_CLIENT, name: VMWARE_CLIENT,
title: i18n.t(`applications.applicationsType.${VMWARE_CLIENT}`), title: i18n.t(`applications.applicationsType.${VMWARE_CLIENT}`),
type: 'primary', type: 'primary',
can: isValidateLicense, has: isValidateLicense,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: VMWARE_CLIENT, category: REMOTEAPP_CATEGORY }}) } callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: VMWARE_CLIENT, category: REMOTEAPP_CATEGORY }}) }
}, },
{ {
name: CUSTOM, name: CUSTOM,
title: i18n.t(`applications.applicationsType.${CUSTOM}`), title: i18n.t(`applications.applicationsType.${CUSTOM}`),
type: 'primary', type: 'primary',
can: isValidateLicense, has: isValidateLicense,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: CUSTOM, category: REMOTEAPP_CATEGORY }}) } callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: CUSTOM, category: REMOTEAPP_CATEGORY }}) }
} }
] ]
@ -56,29 +56,29 @@ export const DATABASE = [
name: MYSQL, name: MYSQL,
title: i18n.t(`applications.applicationsType.${MYSQL}`), title: i18n.t(`applications.applicationsType.${MYSQL}`),
type: 'primary', type: 'primary',
can: true, has: true,
divided: true, divided: isValidateLicense,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: MYSQL, category: DATABASE_CATEGORY }}) } callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: MYSQL, category: DATABASE_CATEGORY }}) }
}, },
{ {
name: ORACLE, name: ORACLE,
title: i18n.t(`applications.applicationsType.${ORACLE}`), title: i18n.t(`applications.applicationsType.${ORACLE}`),
type: 'primary', type: 'primary',
can: isValidateLicense, has: isValidateLicense,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: ORACLE, category: DATABASE_CATEGORY }}) } callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: ORACLE, category: DATABASE_CATEGORY }}) }
}, },
{ {
name: POSTGRESQL, name: POSTGRESQL,
title: i18n.t(`applications.applicationsType.${POSTGRESQL}`), title: i18n.t(`applications.applicationsType.${POSTGRESQL}`),
type: 'primary', type: 'primary',
can: isValidateLicense, has: isValidateLicense,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: POSTGRESQL, category: DATABASE_CATEGORY }}) } callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: POSTGRESQL, category: DATABASE_CATEGORY }}) }
}, },
{ {
name: MARIADB, name: MARIADB,
title: i18n.t(`applications.applicationsType.${MARIADB}`), title: i18n.t(`applications.applicationsType.${MARIADB}`),
type: 'primary', type: 'primary',
can: isValidateLicense, has: isValidateLicense,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: MARIADB, category: DATABASE_CATEGORY }}) } callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: MARIADB, category: DATABASE_CATEGORY }}) }
} }
] ]
@ -92,7 +92,7 @@ export const CLOUD = [
title: i18n.t(`applications.applicationsType.${KUBERNETES}`), title: i18n.t(`applications.applicationsType.${KUBERNETES}`),
divided: true, divided: true,
type: 'primary', type: 'primary',
can: true, has: true,
callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: KUBERNETES, category: CLOUD_CATEGORY }}) } callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: KUBERNETES, category: CLOUD_CATEGORY }}) }
} }
] ]

View File

@ -83,7 +83,7 @@ export default {
if (this.publicSettings.XPACK_ENABLED) { if (this.publicSettings.XPACK_ENABLED) {
return this.publicSettings.XPACK_LICENSE_IS_VALID return this.publicSettings.XPACK_LICENSE_IS_VALID
} }
return true return false
}, },
cardTitle() { cardTitle() {
return '' return ''