Merge pull request #10210 from dataease/pr@dev-v2@fix_dashboard_link

fix(仪表板): 公共链接权限受当前浏览器中登录用户的权限影响
This commit is contained in:
fit2cloud-chenyw 2024-06-12 11:57:19 +08:00 committed by GitHub
commit af896f96a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 1 deletions

View File

@ -30,6 +30,7 @@ import io.dataease.exception.DEException;
import io.dataease.i18n.Translator;
import io.dataease.result.ResultCode;
import io.dataease.system.manage.CorePermissionManage;
import io.dataease.utils.AuthUtils;
import io.dataease.utils.BeanUtils;
import io.dataease.utils.JsonUtil;
import jakarta.annotation.Resource;
@ -85,6 +86,10 @@ public class ChartDataManage {
if (ObjectUtils.isEmpty(view)) {
DEException.throwException(ResultCode.DATA_IS_WRONG.code(), Translator.get("i18n_chart_delete"));
}
if (ObjectUtils.isNotEmpty(AuthUtils.getUser())) {
chartExtRequest.setUser(AuthUtils.getUser().getUserId());
}
//如果是excel导出 如果是从仪表板获取图表数据则仪表板的查询模式查询结果的数量覆盖图表对应的属性
if (view.getIsExcelExport()) {

View File

@ -1,6 +1,8 @@
import { useCache } from '@/hooks/web/useCache'
import { refreshApi } from '@/api/login'
import { useUserStoreWithOut } from '@/store/modules/user'
import { isLink } from '@/utils/utils'
const { wsCache } = useCache()
const userStore = useUserStoreWithOut()
const refreshUrl = '/login/refresh'
@ -39,6 +41,9 @@ export const configHandler = config => {
if (desktop) {
return config
}
if (isLink()) {
return config
}
if (wsCache.get('user.token')) {
config.headers['X-DE-TOKEN'] = wsCache.get('user.token')
const expired = isExpired()

View File

@ -50,7 +50,7 @@ router.beforeEach(async (to, from, next) => {
}
}
await appearanceStore.setAppearance()
if (wsCache.get('user.token') || isDesktop) {
if ((wsCache.get('user.token') || isDesktop) && !to.path.startsWith('/de-link/')) {
if (!userStore.getUid) {
await userStore.setUser()
}

View File

@ -147,3 +147,7 @@ export function cutTargetTree(tree: BusiTreeNode[], targetId: string | number) {
}
})
}
export const isLink = () => {
return window.location.hash.startsWith('#/de-link/')
}