From ddfbc355e8074918a81418d476f52ab355a2360c Mon Sep 17 00:00:00 2001 From: CaptainB Date: Thu, 30 Mar 2023 21:44:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E5=88=B7=E6=96=B0=E9=A1=B5=E9=9D=A2=E6=97=B6=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=95=B0=E6=8D=AE=E5=BA=93=E4=B8=AD=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1024582 --user=刘瑞斌 【系统设置】调用接口切换当前工作空间后,再次访问没有进入正确的工作空间 https://www.tapd.cn/55049933/s/1357919 --- .../io/metersphere/gateway/controller/LoginController.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/framework/gateway/src/main/java/io/metersphere/gateway/controller/LoginController.java b/framework/gateway/src/main/java/io/metersphere/gateway/controller/LoginController.java index 7e392a7c72..0ef55d9fdd 100644 --- a/framework/gateway/src/main/java/io/metersphere/gateway/controller/LoginController.java +++ b/framework/gateway/src/main/java/io/metersphere/gateway/controller/LoginController.java @@ -4,10 +4,12 @@ import io.metersphere.base.domain.User; import io.metersphere.commons.constants.OperLogConstants; import io.metersphere.commons.constants.OperLogModule; import io.metersphere.commons.constants.SessionConstants; +import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.utils.RsaKey; import io.metersphere.commons.utils.RsaUtil; import io.metersphere.controller.handler.ResultHolder; import io.metersphere.dto.ServiceDTO; +import io.metersphere.dto.UserDTO; import io.metersphere.gateway.service.AuthSourceService; import io.metersphere.gateway.service.BaseDisplayService; import io.metersphere.gateway.service.SystemParameterService; @@ -27,6 +29,7 @@ import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; import jakarta.annotation.Resource; + import java.io.IOException; import java.util.List; import java.util.Locale; @@ -67,6 +70,10 @@ public class LoginController { if (StringUtils.isBlank(((User) r).getLastProjectId())) { ((User) r).setLastProjectId("no_such_project"); } + // 使用数据库里的最新用户权限,不同的tab sessionId 不变 + UserDTO userDTO = userLoginService.getUserDTO(((User) r).getId()); + SessionUser sessionUser = SessionUser.fromUser(userDTO, sessionId); + return ResultHolder.success(sessionUser); } return ResultHolder.success(r); });