wolfboys commented on code in PR #1868:
URL:
https://github.com/apache/incubator-streampark/pull/1868#discussion_r998962759
##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/system/service/impl/UserServiceImpl.java:
##########
@@ -203,6 +210,39 @@ public List<User> findByAppOwner(Long teamId) {
return baseMapper.findByAppOwner(teamId);
}
+ /**
+ * generate user info, contains: 1.token, 2.vue router, 3.role,
4.permission, 5.personalized config info of frontend
+ *
+ * @param user user
+ * @return UserInfo
+ */
+ @Override
+ public Map<String, Object> generateFrontendUserInfo(User user, JWTToken
token) {
+ AssertUtils.checkNotNull(user);
+ String username = user.getUsername();
+ Map<String, Object> userInfo = new HashMap<>(8);
+
+ // 1) token & expire
+ if (token != null) {
+ userInfo.put("token", token.getToken());
+ userInfo.put("expire", token.getExpireAt());
+ }
+
+ // 2) user
+ user.dataMasking();
+ userInfo.put("user", user);
+
+ // 3) roles
+ Set<String> roles = this.roleService.getUserRoleName(username);
+ userInfo.put("roles", roles);
+
+ // 4) permissions
+ Set<String> permissions = this.getPermissions(username);
+ userInfo.put("permissions", permissions);
Review Comment:
> Could we return routers here? And remove getRouter.
>
> As I understand, user, roles, permissions and routers should be return
together after team is changed.
The latest routers need to request another interface, It is not returned
with these bindings
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]