fix: 修复权限相关问题

This commit is contained in:
CaptainB 2022-06-17 14:13:42 +08:00 committed by 刘瑞斌
parent 08afbf3cdc
commit c820afaf00
1 changed files with 11 additions and 1 deletions

View File

@ -689,7 +689,17 @@ public class UserService {
List<UserGroup> projectUserGroups = user.getUserGroups().stream()
.filter(ug -> StringUtils.equals(user.getLastProjectId(), ug.getSourceId()))
.collect(Collectors.toList());
return CollectionUtils.isNotEmpty(projectUserGroups);
if (CollectionUtils.isNotEmpty(projectUserGroups)) {
Project project = projectMapper.selectByPrimaryKey(user.getLastProjectId());
if (StringUtils.equals(project.getWorkspaceId(), user.getLastWorkspaceId())) {
return true;
}
// last_project_id last_workspace_id 对应不上了
user.setLastWorkspaceId(project.getWorkspaceId());
updateUser(user);
SessionUtils.putUser(SessionUser.fromUser(user));
return true;
}
}
return false;
}