diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java index 7f484f916f..dc2095ee63 100644 --- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java +++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java @@ -33,6 +33,7 @@ import org.apache.streampark.console.system.authentication.JWTUtil; import org.apache.streampark.console.system.entity.Member; import org.apache.streampark.console.system.entity.Role; +import org.apache.streampark.console.system.entity.Team; import org.apache.streampark.console.system.entity.User; import org.apache.streampark.console.system.mapper.UserMapper; import org.apache.streampark.console.system.service.MemberService; @@ -287,6 +288,13 @@ public Map generateFrontendUserInfo(User user, JWTToken token) { user.dataMasking(); userInfo.put("user", user); + if (user.getLastTeamId() == null) { + List teams = this.teamService.listByUserId(user.getUserId()); + if (!teams.isEmpty()) { + user.setLastTeamId(teams.get(0).getId()); + } + } + // 3) permissions Set permissions = this.listPermissions(user.getUserId(), user.getLastTeamId()); userInfo.put("permissions", permissions);