forked from github/dataease
Merge branch 'dev' into pr@dev_memory_component
This commit is contained in:
commit
40547c7da3
@ -107,7 +107,7 @@ curl -sSL https://github.com/dataease/dataease/releases/latest/download/quick_st
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2014-2022 飞致云 FIT2CLOUD, All rights reserved.
|
||||
Copyright (c) 2014-2023 飞致云 FIT2CLOUD, All rights reserved.
|
||||
|
||||
Licensed under The GNU General Public License version 3 (GPLv3) (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.dataease.auth.filter;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.auth0.jwt.algorithms.Algorithm;
|
||||
import io.dataease.auth.entity.SysUserEntity;
|
||||
import io.dataease.auth.entity.TokenInfo;
|
||||
import io.dataease.auth.service.AuthUserService;
|
||||
@ -9,6 +10,8 @@ import io.dataease.commons.license.DefaultLicenseService;
|
||||
import io.dataease.commons.license.F2CLicenseResponse;
|
||||
import io.dataease.commons.utils.CommonBeanFactory;
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.exception.DataEaseException;
|
||||
import io.dataease.i18n.Translator;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.web.filter.AccessControlFilter;
|
||||
@ -37,10 +40,10 @@ public class F2CDocFilter extends AccessControlFilter {
|
||||
DefaultLicenseService defaultLicenseService = CommonBeanFactory.getBean(DefaultLicenseService.class);
|
||||
F2CLicenseResponse f2CLicenseResponse = defaultLicenseService.validateLicense();
|
||||
Status status = f2CLicenseResponse.getStatus();
|
||||
if (status != Status.valid) {
|
||||
/*if (status != Status.valid) {
|
||||
request.setAttribute(RESULT_URI_KEY, NOLIC_PAGE);
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
} catch (Exception e) {
|
||||
request.setAttribute(RESULT_URI_KEY, NOLIC_PAGE);
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
@ -62,7 +65,7 @@ public class F2CDocFilter extends AccessControlFilter {
|
||||
return true;
|
||||
}
|
||||
|
||||
private Boolean validateLogin(HttpServletRequest request) throws Exception{
|
||||
private Boolean validateLogin(HttpServletRequest request) throws Exception {
|
||||
String authorization = request.getHeader("Authorization");
|
||||
if (StringUtils.isBlank(authorization)) {
|
||||
Cookie[] cookies = request.getCookies();
|
||||
@ -76,6 +79,12 @@ public class F2CDocFilter extends AccessControlFilter {
|
||||
if (StringUtils.isBlank(authorization)) {
|
||||
return false;
|
||||
}
|
||||
if (JWTUtils.loginExpire(authorization)) {
|
||||
return false;
|
||||
}
|
||||
if (JWTUtils.needRefresh(authorization)) {
|
||||
authorization = refreshToken(authorization);
|
||||
}
|
||||
TokenInfo tokenInfo = JWTUtils.tokenInfoByToken(authorization);
|
||||
AuthUserService authUserService = CommonBeanFactory.getBean(AuthUserService.class);
|
||||
SysUserEntity user = authUserService.getUserById(tokenInfo.getUserId());
|
||||
@ -87,12 +96,29 @@ public class F2CDocFilter extends AccessControlFilter {
|
||||
return verify;
|
||||
}
|
||||
|
||||
private String refreshToken(String token) throws Exception {
|
||||
TokenInfo tokenInfo = JWTUtils.tokenInfoByToken(token);
|
||||
AuthUserService authUserService = CommonBeanFactory.getBean(AuthUserService.class);
|
||||
SysUserEntity user = authUserService.getUserById(tokenInfo.getUserId());
|
||||
if (user == null) {
|
||||
DataEaseException.throwException(Translator.get("i18n_not_find_user"));
|
||||
}
|
||||
String password = user.getPassword();
|
||||
Algorithm algorithm = Algorithm.HMAC256(password);
|
||||
JWTUtils.verifySign(algorithm, token);
|
||||
String newToken = JWTUtils.sign(tokenInfo, password);
|
||||
return newToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onAccessDenied(ServletRequest req, ServletResponse res) throws Exception {
|
||||
HttpServletResponse response = (HttpServletResponse) res;
|
||||
HttpServletRequest request = (HttpServletRequest) req;
|
||||
Object attribute = request.getAttribute(RESULT_URI_KEY);
|
||||
String path = ObjectUtils.isNotEmpty(attribute) ? attribute.toString() : DEFAULT_FAILED_PAGE;
|
||||
path += ("?_t" + System.currentTimeMillis());
|
||||
response.setHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");
|
||||
response.setHeader("Expires", "0");
|
||||
request.getRequestDispatcher(path).forward(request, response);
|
||||
return false;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class PanelGroupExtendDataService {
|
||||
if (CollectionUtils.isNotEmpty(extendDataList)) {
|
||||
ChartViewDTO chartViewTemplate = gson.fromJson(extendDataList.get(0).getViewDetails(), ChartViewDTO.class);
|
||||
Map<String, Object> dataInfo = chartViewTemplate.getData();
|
||||
if (dataInfo.get(transDataKey) != null) {
|
||||
if (dataInfo != null && dataInfo.get(transDataKey) != null) {
|
||||
dataInfo.put("data", dataInfo.get(transDataKey));
|
||||
dataInfo.remove(transDataKey);
|
||||
}
|
||||
|
@ -138,6 +138,9 @@ public class PanelGroupService {
|
||||
@Resource
|
||||
private PanelWatermarkMapper panelWatermarkMapper;
|
||||
|
||||
@Resource
|
||||
private DatasourceMapper datasourceMapper;
|
||||
|
||||
public List<PanelGroupDTO> tree(PanelGroupRequest panelGroupRequest) {
|
||||
String userId = String.valueOf(AuthUtils.getUser().getUserId());
|
||||
panelGroupRequest.setUserId(userId);
|
||||
@ -1019,6 +1022,9 @@ public class PanelGroupService {
|
||||
templateLog.setDatasourceId(newDatasourceId);
|
||||
if (PanelConstants.APP_DATASOURCE_FROM.NEW.equals(request.getDatasourceFrom())) {
|
||||
templateLog.setSourceDatasourceName(request.getDatasourceList().get(0).getName());
|
||||
} else {
|
||||
Datasource applyDatasourceInfo = datasourceMapper.selectByPrimaryKey(newDatasourceId);
|
||||
templateLog.setSourceDatasourceName(applyDatasourceInfo.getName());
|
||||
}
|
||||
templateLog.setDatasetGroupId(asideDatasetGroupId);
|
||||
templateLog.setSourceDatasetGroupName(request.getDatasetGroupName());
|
||||
@ -1062,9 +1068,10 @@ public class PanelGroupService {
|
||||
datasetGroupHistoryInfo.setName(request.getDatasetGroupName());
|
||||
datasetGroupHistoryInfo.setPid(request.getDatasetGroupPid());
|
||||
datasetGroupMapper.updateByPrimaryKey(datasetGroupHistoryInfo);
|
||||
|
||||
//数据源变更
|
||||
panelAppTemplateService.editDatasource(request.getDatasourceList());
|
||||
if ("new".equals(request.getDatasourceFrom())) {
|
||||
//数据源变更
|
||||
panelAppTemplateService.editDatasource(request.getDatasourceList());
|
||||
}
|
||||
}
|
||||
|
||||
public void toTop(String panelId) {
|
||||
|
@ -49,12 +49,25 @@ public class PanelSubjectService {
|
||||
if (StringUtils.isEmpty(request.getId())) {
|
||||
PanelSubjectExample example = new PanelSubjectExample();
|
||||
example.createCriteria().andTypeEqualTo("self");
|
||||
example.setOrderByClause("create_time desc");
|
||||
List<PanelSubject> subjectAll = panelSubjectMapper.selectByExample(example);
|
||||
int count = CollectionUtils.isEmpty(subjectAll) ? 0 : subjectAll.size();
|
||||
int count = CollectionUtils.isEmpty(subjectAll) ? 1 : subjectAll.get(0).getCreateNum() + 1;
|
||||
String subjectName = "个人主题" + count;
|
||||
if (!CollectionUtils.isEmpty(subjectAll)) {
|
||||
for (PanelSubject subject : subjectAll) {
|
||||
if (subjectName.equals(subject.getName())) {
|
||||
count++;
|
||||
subjectName = "个人主题" + count;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
request.setId(UUID.randomUUID().toString());
|
||||
request.setCreateTime(System.currentTimeMillis());
|
||||
request.setType("self");
|
||||
request.setName("个人主题" + count);
|
||||
request.setCreateNum(count);
|
||||
panelSubjectMapper.insertSelective(request);
|
||||
} else {
|
||||
PanelSubjectExample example = new PanelSubjectExample();
|
||||
|
@ -644,3 +644,13 @@ INSERT INTO `sys_auth_detail` (`id`, `auth_id`, `privilege_name`, `privilege_typ
|
||||
`copy_from`, `copy_id`)
|
||||
VALUES ('e49bf17e-0af8-11ec-a2b0-0242ac130003', '00590a7c-8e7b-45f4-8428-55532be07602', 'i18n_auth_use', 1, 1, 'use',
|
||||
'基础权限-使用', 'admin', 1630482464000, NULL, NULL, NULL);
|
||||
|
||||
UPDATE `sys_menu`
|
||||
SET `permission` = 'app-template:read'
|
||||
WHERE `menu_id` = 41;
|
||||
UPDATE `sys_menu`
|
||||
SET `permission` = 'app-template-market:read'
|
||||
WHERE `menu_id` = 203;
|
||||
|
||||
ALTER TABLE `panel_subject`
|
||||
ADD COLUMN `create_num` int(13) DEFAULT 0 COMMENT '创建序号' AFTER `details`;
|
||||
|
File diff suppressed because one or more lines are too long
@ -71,8 +71,8 @@
|
||||
</el-form>
|
||||
<div class="de-row-rules">
|
||||
<span>{{
|
||||
positionCheck('appMarket') ? $t('app_template.datasource_info') : $t('datasource.basic_info')
|
||||
}}</span>
|
||||
positionCheck('appMarket') ? $t('app_template.datasource_info') : $t('datasource.basic_info')
|
||||
}}</span>
|
||||
</div>
|
||||
<el-form
|
||||
ref="historyDsForm"
|
||||
@ -246,7 +246,8 @@
|
||||
v-if="
|
||||
formType === 'add'
|
||||
? true
|
||||
: hasDataPermission('manage', params.privileges)
|
||||
: (hasDataPermission('manage', outerParams.panelPrivileges)
|
||||
||hasDataPermission('manage', outerParams.datasetPrivileges))
|
||||
"
|
||||
@click="validaDatasource"
|
||||
>{{ $t('commons.validate') }}
|
||||
@ -270,7 +271,11 @@
|
||||
>{{ $t('commons.cancel') }}
|
||||
</deBtn>
|
||||
<deBtn
|
||||
v-if="formType === 'add'"
|
||||
v-if="
|
||||
formType === 'add'
|
||||
? true
|
||||
: hasDataPermission('manage', params.privileges)
|
||||
"
|
||||
type="primary"
|
||||
@click="saveAppMarketHistory"
|
||||
>{{ $t('commons.save') }}
|
||||
@ -720,7 +725,7 @@ export default {
|
||||
res.data.apiConfiguration = JSON.parse(Base64.decode(res.data.apiConfigurationStr))
|
||||
}
|
||||
this.params = { ...res.data, showModel }
|
||||
if(showModel === 'copy'){
|
||||
if (showModel === 'copy') {
|
||||
this.params.id = ''
|
||||
}
|
||||
this.$emit('setParams', { ...this.params })
|
||||
@ -809,16 +814,16 @@ export default {
|
||||
},
|
||||
saveAppMarketHistory() {
|
||||
this.$refs.historyDsForm.validate(valid => {
|
||||
if (!valid) {
|
||||
return false
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
const appApplyForm = {
|
||||
...this.attachForm,
|
||||
...this.historyDsForm
|
||||
}
|
||||
const method = this.formType === 'add' ? appApply : appEdit
|
||||
this.appApplyMethod(method, appApplyForm)
|
||||
}
|
||||
const appApplyForm = {
|
||||
...this.attachForm,
|
||||
...this.historyDsForm
|
||||
}
|
||||
const method = this.formType === 'add' ? appApply : appEdit
|
||||
this.appApplyMethod(method, appApplyForm)
|
||||
}
|
||||
)
|
||||
},
|
||||
save() {
|
||||
@ -964,10 +969,10 @@ export default {
|
||||
}
|
||||
if (this.positionCheck('appMarket')) {
|
||||
this.$refs.attachParamsForm.validate(valid => {
|
||||
if (!valid) {
|
||||
return false
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
this.$refs.dsForm.validate((valid) => {
|
||||
@ -1112,10 +1117,10 @@ export default {
|
||||
}
|
||||
if (this.positionCheck('appMarket')) {
|
||||
this.$refs.attachParamsForm.validate(valid => {
|
||||
if (!valid) {
|
||||
return false
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
this.$refs.dsForm.validate((valid) => {
|
||||
|
Loading…
Reference in New Issue
Block a user