fix(仪表板): 分享链接可以获取到分享者敏感信息 #13135

This commit is contained in:
fit2cloud-chenyw 2024-11-06 11:10:14 +08:00
parent 680c3419cd
commit 861bdceaa2
7 changed files with 41 additions and 28 deletions

View File

@ -32,6 +32,8 @@ export const queryFormApi = uid => request.get({ url: `/user/queryById/${uid}` }
export const personInfoApi = () => request.get({ url: `/user/personInfo` }) export const personInfoApi = () => request.get({ url: `/user/personInfo` })
export const ipInfoApi = () => request.get({ url: `/user/ipInfo` })
export const roleCreateApi = data => request.post({ url: '/role/create', data }) export const roleCreateApi = data => request.post({ url: '/role/create', data })
export const roleEditApi = data => request.post({ url: '/role/edit', data }) export const roleEditApi = data => request.post({ url: '/role/edit', data })

View File

@ -2,7 +2,7 @@
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { ref } from 'vue' import { ref } from 'vue'
import { personInfoApi } from '@/api/user' import { ipInfoApi } from '@/api/user'
const dvMainStore = dvMainStoreWithOut() const dvMainStore = dvMainStoreWithOut()
const { dvInfo } = storeToRefs(dvMainStore) const { dvInfo } = storeToRefs(dvMainStore)
@ -163,7 +163,7 @@ export function activeWatermarkCheckUser(domId, canvasId, scale = 1) {
scale scale
) )
} else { } else {
personInfoApi().then(res => { ipInfoApi().then(res => {
userInfo.value = res.data userInfo.value = res.data
if (userInfo.value && userInfo.value.model !== 'lose') { if (userInfo.value && userInfo.value.model !== 'lose') {
activeWatermark( activeWatermark(

View File

@ -16,9 +16,12 @@ import { Icon } from '@/components/icon-custom'
import { download2AppTemplate, downloadCanvas2 } from '@/utils/imgUtils' import { download2AppTemplate, downloadCanvas2 } from '@/utils/imgUtils'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { ElMessage } from 'element-plus-secondary' import { ElMessage } from 'element-plus-secondary'
import { personInfoApi } from '@/api/user'
import AppExportForm from '@/components/de-app/AppExportForm.vue' import AppExportForm from '@/components/de-app/AppExportForm.vue'
import { useEmitt } from '@/hooks/web/useEmitt' import { useEmitt } from '@/hooks/web/useEmitt'
import { useUserStoreWithOut } from '@/store/modules/user'
const userStore = useUserStoreWithOut()
const userName = computed(() => userStore.getName)
const appExportFormRef = ref(null) const appExportFormRef = ref(null)
const dvMainStore = dvMainStoreWithOut() const dvMainStore = dvMainStoreWithOut()
@ -35,8 +38,7 @@ const state = reactive({
canvasStylePreview: null, canvasStylePreview: null,
canvasViewInfoPreview: null, canvasViewInfoPreview: null,
dvInfo: null, dvInfo: null,
curPreviewGap: 0, curPreviewGap: 0
userLoginInfo: {}
}) })
const { fullscreenFlag, canvasViewDataInfo } = storeToRefs(dvMainStore) const { fullscreenFlag, canvasViewDataInfo } = storeToRefs(dvMainStore)
@ -141,7 +143,7 @@ const downLoadToAppPre = () => {
appName: state.dvInfo.name, appName: state.dvInfo.name,
icon: null, icon: null,
version: '2.0', version: '2.0',
creator: state.userLoginInfo?.name, creator: userName.value,
required: '2.9.0', required: '2.9.0',
description: null description: null
}) })
@ -189,18 +191,11 @@ const resourceNodeClick = data => {
} }
const previewShowFlag = computed(() => !!dvMainStore.dvInfo?.name) const previewShowFlag = computed(() => !!dvMainStore.dvInfo?.name)
const findUserData = callback => {
personInfoApi().then(rsp => {
callback(rsp)
})
}
onBeforeMount(() => { onBeforeMount(() => {
if (showPosition.value === 'preview') { if (showPosition.value === 'preview') {
dvMainStore.canvasDataInit() dvMainStore.canvasDataInit()
} }
findUserData(res => {
state.userLoginInfo = res.data
})
}) })
const sideTreeStatus = ref(true) const sideTreeStatus = ref(true)
const changeSideTreeStatus = val => { const changeSideTreeStatus = val => {

View File

@ -17,10 +17,14 @@ import { download2AppTemplate, downloadCanvas2 } from '@/utils/imgUtils'
import MultiplexPreviewShow from '@/views/data-visualization/MultiplexPreviewShow.vue' import MultiplexPreviewShow from '@/views/data-visualization/MultiplexPreviewShow.vue'
import DvPreview from '@/views/data-visualization/DvPreview.vue' import DvPreview from '@/views/data-visualization/DvPreview.vue'
import AppExportForm from '@/components/de-app/AppExportForm.vue' import AppExportForm from '@/components/de-app/AppExportForm.vue'
import { personInfoApi } from '@/api/user'
import { ElMessage } from 'element-plus-secondary' import { ElMessage } from 'element-plus-secondary'
import { useEmitt } from '@/hooks/web/useEmitt' import { useEmitt } from '@/hooks/web/useEmitt'
import { useUserStoreWithOut } from '@/store/modules/user'
const userStore = useUserStoreWithOut()
const userName = computed(() => userStore.getName)
const dvMainStore = dvMainStoreWithOut() const dvMainStore = dvMainStoreWithOut()
const { dvInfo, canvasViewDataInfo } = storeToRefs(dvMainStore) const { dvInfo, canvasViewDataInfo } = storeToRefs(dvMainStore)
const previewCanvasContainer = ref(null) const previewCanvasContainer = ref(null)
@ -136,7 +140,7 @@ const downLoadToAppPre = () => {
appName: state.dvInfo.name, appName: state.dvInfo.name,
icon: null, icon: null,
version: '2.0', version: '2.0',
creator: state.userLoginInfo?.name, creator: userName.value,
required: '2.9.0', required: '2.9.0',
description: null description: null
}) })
@ -170,8 +174,7 @@ const state = reactive({
canvasStylePreview: null, canvasStylePreview: null,
canvasViewInfoPreview: null, canvasViewInfoPreview: null,
dvInfo: null, dvInfo: null,
curPreviewGap: 0, curPreviewGap: 0
userLoginInfo: {}
}) })
const sideTreeStatus = ref(true) const sideTreeStatus = ref(true)
@ -195,12 +198,6 @@ const downLoadApp = appAttachInfo => {
fileDownload('app', appAttachInfo) fileDownload('app', appAttachInfo)
} }
const findUserData = callback => {
personInfoApi().then(rsp => {
callback(rsp)
})
}
onMounted(() => { onMounted(() => {
useEmitt({ useEmitt({
name: 'canvasDownload', name: 'canvasDownload',
@ -218,9 +215,6 @@ onBeforeMount(() => {
if (props.showPosition === 'preview') { if (props.showPosition === 'preview') {
dvMainStore.canvasDataInit() dvMainStore.canvasDataInit()
} }
findUserData(res => {
state.userLoginInfo = res.data
})
}) })
</script> </script>

@ -1 +1 @@
Subproject commit 7d763d1a73750889a5a6abc6faf658aab3c48099 Subproject commit 5f7b10e1f05d5819cffb0633b2b9b76d20d005d5

View File

@ -51,6 +51,10 @@ public interface UserApi {
@GetMapping("/personInfo") @GetMapping("/personInfo")
UserFormVO personInfo(); UserFormVO personInfo();
@Operation(summary = "查询客户端IP信息")
@GetMapping("/ipInfo")
CurIpVO ipInfo();
@Operation(summary = "创建") @Operation(summary = "创建")
@DePermit("m:read") @DePermit("m:read")
@PostMapping("/create") @PostMapping("/create")

View File

@ -0,0 +1,18 @@
package io.dataease.api.permissions.user.vo;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
@Data
public class CurIpVO implements Serializable {
@Serial
private static final long serialVersionUID = -3025566841330382707L;
private String account;
private String name;
private String ip;
}