fix(XPack): license 验证缺陷修复
This commit is contained in:
parent
d370a5bb7b
commit
8f807044ad
|
@ -127,10 +127,4 @@ public class APITestController {
|
|||
public List<ScheduleDao> listSchedule(@RequestBody QueryScheduleRequest request) {
|
||||
return apiTestService.listSchedule(request);
|
||||
}
|
||||
|
||||
@GetMapping("/license/valid")
|
||||
public LicenseDTO valid() {
|
||||
return apiTestService.validateLicense();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -437,13 +437,4 @@ public class APITestService {
|
|||
quotaService.checkAPITestQuota();
|
||||
}
|
||||
}
|
||||
|
||||
public LicenseDTO validateLicense() {
|
||||
LicenseService licenseService = CommonBeanFactory.getBean(LicenseService.class);
|
||||
if (licenseService != null) {
|
||||
return licenseService.valid();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import io.metersphere.commons.constants.UserSource;
|
|||
import io.metersphere.commons.user.SessionUser;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.controller.request.LoginRequest;
|
||||
import io.metersphere.dto.LicenseDTO;
|
||||
import io.metersphere.service.UserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
|
@ -67,4 +68,9 @@ public class LoginController {
|
|||
return userService.getDefaultLanguage();
|
||||
}
|
||||
|
||||
@GetMapping("/api/license/valid")
|
||||
public LicenseDTO valid() {
|
||||
return userService.validateLicense();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import io.metersphere.commons.constants.UserStatus;
|
|||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.user.SessionUser;
|
||||
import io.metersphere.commons.utils.CodingUtil;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.controller.ResultHolder;
|
||||
import io.metersphere.controller.request.LoginRequest;
|
||||
|
@ -19,6 +20,7 @@ import io.metersphere.controller.request.member.QueryMemberRequest;
|
|||
import io.metersphere.controller.request.member.UserRequest;
|
||||
import io.metersphere.controller.request.organization.AddOrgMemberRequest;
|
||||
import io.metersphere.controller.request.organization.QueryOrgMemberRequest;
|
||||
import io.metersphere.dto.LicenseDTO;
|
||||
import io.metersphere.dto.UserDTO;
|
||||
import io.metersphere.dto.UserRoleDTO;
|
||||
import io.metersphere.i18n.Translator;
|
||||
|
@ -589,4 +591,12 @@ public class UserService {
|
|||
public List<User> searchUser(String condition) {
|
||||
return extUserMapper.searchUser(condition);
|
||||
}
|
||||
|
||||
public LicenseDTO validateLicense() {
|
||||
LicenseService licenseService = CommonBeanFactory.getBean(LicenseService.class);
|
||||
if (licenseService != null) {
|
||||
return licenseService.valid();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
<template>
|
||||
<el-col v-if="auth">
|
||||
<el-row id="header-top1" type="flex" justify="space-between" align="middle">
|
||||
<el-row v-if="licenseHeader != null">
|
||||
<el-col>
|
||||
<div class="license-head" v-if="validData.status == 'expired'">License has expired since
|
||||
{{(validData!= undefined && validData.license!= undefined) ? validData.license.expired:''}},please
|
||||
update license.
|
||||
</div>
|
||||
<component :is="licenseHeader"></component>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row id="header-top" type="flex" justify="space-between" align="middle">
|
||||
|
||||
<el-col :span="12">
|
||||
<a class="logo"/>
|
||||
<ms-top-menus/>
|
||||
|
@ -34,15 +30,18 @@
|
|||
import MsHeaderOrgWs from "./components/common/head/HeaderOrgWs";
|
||||
import MsLanguageSwitch from "./components/common/head/LanguageSwitch";
|
||||
import {saveLocalStorage} from "../common/js/utils";
|
||||
import {saveLicense} from "../common/js/utils";
|
||||
import Setting from "@/business/components/settings/router";
|
||||
|
||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||
const header = requireComponent("./license/LicenseMessage.vue");
|
||||
|
||||
export default {
|
||||
name: 'app',
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
validData: {},
|
||||
auth: false
|
||||
licenseHeader: null,
|
||||
auth: false,
|
||||
header: {},
|
||||
}
|
||||
},
|
||||
beforeCreate() {
|
||||
|
@ -51,6 +50,10 @@
|
|||
this.$setLang(response.data.data.language);
|
||||
saveLocalStorage(response.data);
|
||||
this.auth = true;
|
||||
// 是否显示校验信息
|
||||
if (header.default !== undefined) {
|
||||
this.licenseHeader = "MsLicenseHeader";
|
||||
}
|
||||
} else {
|
||||
window.location.href = "/login"
|
||||
}
|
||||
|
@ -58,21 +61,18 @@
|
|||
window.location.href = "/login"
|
||||
});
|
||||
},
|
||||
beforeMount() {
|
||||
// 验证license
|
||||
this.result = this.$get("/api/license/valid", response => {
|
||||
let data = response.data;
|
||||
if (data != undefined && data != null) {
|
||||
this.validData = response.data;
|
||||
saveLicense(response.data);
|
||||
components: {
|
||||
MsLanguageSwitch,
|
||||
MsUser,
|
||||
MsView,
|
||||
MsTopMenus,
|
||||
MsHeaderOrgWs,
|
||||
"MsLicenseHeader": header.default
|
||||
}
|
||||
});
|
||||
},
|
||||
components: {MsLanguageSwitch, MsUser, MsView, MsTopMenus, MsHeaderOrgWs},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
#header-top {
|
||||
width: 100%;
|
||||
|
@ -128,4 +128,3 @@
|
|||
color: white;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
Loading…
Reference in New Issue