fix: 用户修改last_workspace_id之后执行登录被覆盖的问题

This commit is contained in:
CaptainB 2022-06-01 18:48:19 +08:00 committed by f2c-ci-robot[bot]
parent b7f165c9ce
commit 72bb76e5e4
1 changed files with 10 additions and 0 deletions

View File

@ -632,6 +632,7 @@ public class UserService {
}
private void autoSwitch(UserDTO user) {
// 用户有 last_project_id 权限
if (StringUtils.isNotBlank(user.getLastProjectId())) {
List<UserGroup> projectUserGroups = user.getUserGroups().stream()
.filter(ug -> StringUtils.equals(user.getLastProjectId(), ug.getSourceId()))
@ -640,6 +641,15 @@ public class UserService {
return;
}
}
// 用户有 last_workspace_id 权限
if (StringUtils.isNotBlank(user.getLastWorkspaceId())) {
List<UserGroup> workspaceUserGroups = user.getUserGroups().stream()
.filter(ug -> StringUtils.equals(user.getLastWorkspaceId(), ug.getSourceId()))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(workspaceUserGroups)) {
return;
}
}
List<UserGroup> userGroups = user.getUserGroups();
List<String> projectGroupIds = user.getGroups()
.stream().filter(ug -> StringUtils.equals(ug.getType(), UserGroupType.PROJECT))