vernedeng commented on code in PR #8441:
URL: https://github.com/apache/inlong/pull/8441#discussion_r1255142219
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/user/TenantRoleServiceImpl.java:
##########
@@ -121,4 +122,17 @@ public TenantRoleInfo getByUsernameAndTenant(String name,
String tenant) {
return CommonBeanUtils.copyProperties(entity, TenantRoleInfo::new);
}
+ @Override
+ public List<String> listTenantByUsername(String username) {
+ TenantRolePageRequest request = new TenantRolePageRequest();
+ request.setPageNum(1);
+ request.setPageSize(Integer.MAX_VALUE);
+ request.setUsername(username);
+ PageResult<TenantRoleInfo> tenantRoleInfoList =
listByCondition(request);
+ return tenantRoleInfoList.getList().stream()
+ .map(TenantRoleInfo::getTenant)
+ .distinct()
Review Comment:
In order to reuse **_listByCondition_**.
Usually, each user has only one role in each tenant.
The **_distinct_** process is to remove duplicate tenant if a user is both
the ADMIN and OPERATOR in the same tenant.
--
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]