From 85a8f3eadbc53fd0c6606a74f403387c930ea589 Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Tue, 7 Mar 2023 14:10:42 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E4=BB=AA=E8=A1=A8=E6=9D=BF=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E4=B8=8D=E5=8C=BA=E5=88=86=E5=A4=A7=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/panel/list/PanelList.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/panel/list/PanelList.vue b/frontend/src/views/panel/list/PanelList.vue index d272855a9f..1356c7630d 100644 --- a/frontend/src/views/panel/list/PanelList.vue +++ b/frontend/src/views/panel/list/PanelList.vue @@ -1127,8 +1127,9 @@ export default { }, filterNode(value, data) { if (!value) return true + const result = data.label.toLowerCase().indexOf(value.toLowerCase()) !== -1 if (this.searchType === 'folder') { - if (data.nodeType === 'folder' && data.label.indexOf(value) !== -1) { + if (data.nodeType === 'folder' && result) { this.searchPids.push(data.id) return true } @@ -1139,7 +1140,7 @@ export default { return true } } else { - return data.label.indexOf(value) !== -1 + return result } return false }, From 7e8445ba8c4d62c9b6b51ffcf12b3f080e98efb2 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 7 Mar 2023 17:55:19 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E8=8E=B7=E5=8F=96=E5=A4=9A=E4=BD=99=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=E6=BC=8F=E6=B4=9E=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataease/auth/api/dto/CurrentUserDto.java | 5 ++++ .../auth/service/impl/ShiroServiceImpl.java | 2 +- .../controller/sys/SystemInfoController.java | 23 +++++++++++++++---- .../io/dataease/dto/UserLoginInfoDTO.java | 5 ++++ .../dataease/service/SystemInfoService.java | 20 ++++++++-------- frontend/src/api/systemInfo/userLogin.js | 4 ++-- .../canvas/components/editor/Preview.vue | 2 +- 7 files changed, 44 insertions(+), 17 deletions(-) diff --git a/backend/src/main/java/io/dataease/auth/api/dto/CurrentUserDto.java b/backend/src/main/java/io/dataease/auth/api/dto/CurrentUserDto.java index 9bc1ac61e3..8e056e51a2 100644 --- a/backend/src/main/java/io/dataease/auth/api/dto/CurrentUserDto.java +++ b/backend/src/main/java/io/dataease/auth/api/dto/CurrentUserDto.java @@ -17,4 +17,9 @@ public class CurrentUserDto extends SysUserEntity implements Serializable { @ApiModelProperty("权限集合") private List permissions; + + public CurrentUserDto(String username, String nickName) { + super.setUsername(username); + super.setNickName(nickName); + } } diff --git a/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java b/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java index b076281cf3..e355173d78 100644 --- a/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java +++ b/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java @@ -129,7 +129,7 @@ public class ShiroServiceImpl implements ShiroService { filterChainDefinitionMap.put("/panel/group/exportDetails", ANON); filterChainDefinitionMap.put("/dataset/field/linkMultFieldValues", "link"); filterChainDefinitionMap.put("/dataset/field/linkMappingFieldValues", "link"); - filterChainDefinitionMap.put("/systemInfo/proxyUserLoginInfo/**", ANON); + filterChainDefinitionMap.put("/systemInfo/proxyUserLoginInfo", ANON); filterChainDefinitionMap.put("/**", "authc"); diff --git a/backend/src/main/java/io/dataease/controller/sys/SystemInfoController.java b/backend/src/main/java/io/dataease/controller/sys/SystemInfoController.java index 5322ca8e12..a7203dc9dc 100644 --- a/backend/src/main/java/io/dataease/controller/sys/SystemInfoController.java +++ b/backend/src/main/java/io/dataease/controller/sys/SystemInfoController.java @@ -1,14 +1,20 @@ package io.dataease.controller.sys; +import com.auth0.jwt.JWT; +import com.auth0.jwt.interfaces.DecodedJWT; +import io.dataease.auth.filter.F2CLinkFilter; import io.dataease.dto.UserLoginInfoDTO; import io.dataease.service.SystemInfoService; +import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; import springfox.documentation.annotations.ApiIgnore; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import java.io.IOException; @ApiIgnore @@ -23,8 +29,17 @@ public class SystemInfoController { return systemInfoService.getUserLoginInfo(null); } - @GetMapping("proxyUserLoginInfo/{userId}") - public UserLoginInfoDTO proxyUserLoginInfo(@PathVariable String userId) throws IOException { - return systemInfoService.getUserLoginInfo(userId); + @GetMapping("proxyUserLoginInfo") + public UserLoginInfoDTO proxyUserLoginInfo() throws IOException { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()) + .getRequest(); + String linkToken = request.getHeader(F2CLinkFilter.LINK_TOKEN_KEY); + if (StringUtils.isNotEmpty(linkToken)) { + DecodedJWT jwt = JWT.decode(linkToken); + return systemInfoService.getUserLoginInfo(jwt.getClaim("userId").asLong()); + } else { + return null; + } + } } diff --git a/backend/src/main/java/io/dataease/dto/UserLoginInfoDTO.java b/backend/src/main/java/io/dataease/dto/UserLoginInfoDTO.java index 35be339932..de3743175b 100644 --- a/backend/src/main/java/io/dataease/dto/UserLoginInfoDTO.java +++ b/backend/src/main/java/io/dataease/dto/UserLoginInfoDTO.java @@ -22,4 +22,9 @@ public class UserLoginInfoDTO { this.userInfo = userInfo; this.ip = ip; } + + public UserLoginInfoDTO(String username, String nickname, String ip) { + this.userInfo = new CurrentUserDto(username, nickname); + this.ip = ip; + } } diff --git a/backend/src/main/java/io/dataease/service/SystemInfoService.java b/backend/src/main/java/io/dataease/service/SystemInfoService.java index b9d2dfb7e3..72e5770efb 100644 --- a/backend/src/main/java/io/dataease/service/SystemInfoService.java +++ b/backend/src/main/java/io/dataease/service/SystemInfoService.java @@ -2,12 +2,10 @@ package io.dataease.service; import io.dataease.auth.api.dto.CurrentUserDto; import io.dataease.commons.utils.AuthUtils; -import io.dataease.commons.utils.BeanUtils; import io.dataease.commons.utils.IPUtils; import io.dataease.dto.UserLoginInfoDTO; import io.dataease.plugins.common.base.domain.SysUser; import io.dataease.plugins.common.base.mapper.SysUserMapper; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -18,14 +16,18 @@ public class SystemInfoService { @Resource private SysUserMapper sysUserMapper; - public UserLoginInfoDTO getUserLoginInfo(String userId) { - if (StringUtils.isNotEmpty(userId)) { - SysUser userInfo = sysUserMapper.selectByPrimaryKey(Long.parseLong(userId)); - CurrentUserDto userDto = new CurrentUserDto(); - BeanUtils.copyBean(userDto, userInfo); - return new UserLoginInfoDTO(userDto, IPUtils.get()); + public UserLoginInfoDTO getUserLoginInfo(Long userId) { + if (userId != null) { + SysUser userInfo = sysUserMapper.selectByPrimaryKey(userId); + return new UserLoginInfoDTO(userInfo.getUsername(), userInfo.getNickName(), IPUtils.get()); + } + CurrentUserDto userDto = AuthUtils.getUser(); + if (userDto != null) { + return new UserLoginInfoDTO(userDto.getUsername(), userDto.getNickName(), IPUtils.get()); + } else { + return new UserLoginInfoDTO(null, null, IPUtils.get()); } - return new UserLoginInfoDTO(AuthUtils.getUser(), IPUtils.get()); } + } diff --git a/frontend/src/api/systemInfo/userLogin.js b/frontend/src/api/systemInfo/userLogin.js index 87ab9fc4af..3c57c99ed4 100644 --- a/frontend/src/api/systemInfo/userLogin.js +++ b/frontend/src/api/systemInfo/userLogin.js @@ -8,9 +8,9 @@ export function userLoginInfo() { }) } -export function proxyUserLoginInfo(userId) { +export function proxyUserLoginInfo() { return request({ - url: '/systemInfo/proxyUserLoginInfo/' + userId, + url: '/systemInfo/proxyUserLoginInfo', method: 'get', loading: false }) diff --git a/frontend/src/components/canvas/components/editor/Preview.vue b/frontend/src/components/canvas/components/editor/Preview.vue index 6e305c0772..0f0bf5474c 100644 --- a/frontend/src/components/canvas/components/editor/Preview.vue +++ b/frontend/src/components/canvas/components/editor/Preview.vue @@ -485,7 +485,7 @@ export default { activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, waterDomId, this.canvasId, this.panelInfo.watermarkOpen) } else { const method = this.userId ? proxyUserLoginInfo : userLoginInfo - method(this.userId).then(res => { + method().then(res => { this.userInfo = res.data activeWatermark(this.panelInfo.watermarkInfo.settingContent, this.userInfo, waterDomId, this.canvasId, this.panelInfo.watermarkOpen) }) From 866b696fbd96248997b7412cc4022fb5791a0fe6 Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Tue, 7 Mar 2023 18:43:29 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20SQL=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E6=95=B0=E6=8D=AE=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/dataset/add/AddSQL.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/dataset/add/AddSQL.vue b/frontend/src/views/dataset/add/AddSQL.vue index 25c7b80365..bfbfa3275c 100644 --- a/frontend/src/views/dataset/add/AddSQL.vue +++ b/frontend/src/views/dataset/add/AddSQL.vue @@ -911,7 +911,7 @@ export default { }, initTableInfo() { - if (this.param.tableId) { + if (this.param.tableId || this.$route.query.id) { getTable(this.param.tableId).then((response) => { const table = response.data this.dataSource = table.dataSourceId From fe14ddc2a9c141e212e13f9b6b9f8b2819f872f6 Mon Sep 17 00:00:00 2001 From: dataeaseShu <106045316+dataeaseShu@users.noreply.github.com> Date: Tue, 7 Mar 2023 18:45:39 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20SQL=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E6=95=B0=E6=8D=AE=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/dataset/add/AddSQL.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/dataset/add/AddSQL.vue b/frontend/src/views/dataset/add/AddSQL.vue index bfbfa3275c..a5860f5e15 100644 --- a/frontend/src/views/dataset/add/AddSQL.vue +++ b/frontend/src/views/dataset/add/AddSQL.vue @@ -911,8 +911,9 @@ export default { }, initTableInfo() { - if (this.param.tableId || this.$route.query.id) { - getTable(this.param.tableId).then((response) => { + const tableId = this.param.tableId || this.$route.query.id + if (tableId) { + getTable(tableId).then((response) => { const table = response.data this.dataSource = table.dataSourceId this.changeDatasource()