fix: 处理用户登录autoswitch

This commit is contained in:
Captain.B 2021-05-26 21:27:23 +08:00 committed by 刘瑞斌
parent d95db82cee
commit c262beb5a0
1 changed files with 51 additions and 44 deletions

View File

@ -808,7 +808,14 @@ public class UserService {
}
private void autoSwitch(UserDTO user) {
if (StringUtils.isEmpty(user.getLastProjectId())) {
if (StringUtils.isNotBlank(user.getLastProjectId())) {
List<UserGroup> projectUserGroups = user.getUserGroups().stream()
.filter(ug -> StringUtils.equals(user.getLastProjectId(), ug.getSourceId()))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(projectUserGroups)) {
return;
}
}
List<UserGroup> userGroups = user.getUserGroups();
List<String> projectGroupIds = user.getGroups()
.stream().filter(ug -> StringUtils.equals(ug.getType(), UserGroupType.PROJECT))
@ -854,7 +861,7 @@ public class UserService {
updateUser(user);
SecurityUtils.getSubject().getSession().setAttribute(ATTR_USER, user);
}
}
}
public List<User> searchUser(String condition) {