diff --git a/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/provider/rbac/service/RbacPermissionResourceMemberService.kt b/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/provider/rbac/service/RbacPermissionResourceMemberService.kt index 227c79adfc0..d5525d3fb69 100644 --- a/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/provider/rbac/service/RbacPermissionResourceMemberService.kt +++ b/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/provider/rbac/service/RbacPermissionResourceMemberService.kt @@ -466,19 +466,23 @@ class RbacPermissionResourceMemberService( page = 1 } val groupMemberInfoList = iamV2ManagerService.getRoleGroupMemberV2(groupInfo.id, pageInfoDTO).results - val members = mutableListOf() + val nowTimestamp = System.currentTimeMillis() / 1000 - groupMemberInfoList.forEach { memberInfo -> - if (memberInfo.type == ManagerScopesEnum.getType(ManagerScopesEnum.USER) && - memberInfo.expiredAt > nowTimestamp) { - members.add(memberInfo.id) - } - } + val (members, deptInfoList) = groupMemberInfoList + .filter { it.expiredAt > nowTimestamp } + .partition { it.type == ManagerScopesEnum.getType(ManagerScopesEnum.USER) } + return BkAuthGroupAndUserList( displayName = groupInfo.name, roleId = groupInfo.id, roleName = groupInfo.name, - userIdList = members.toSet().toList(), + userIdList = members.map { it.id }, + deptInfoList = deptInfoList.map { memberInfo -> + RoleGroupMemberInfo().apply { + id = memberInfo.id + name = memberInfo.name + } + }, type = "" ) } diff --git a/src/backend/ci/core/common/common-auth/common-auth-api/src/main/kotlin/com/tencent/devops/common/auth/api/pojo/BkAuthGroupAndUserList.kt b/src/backend/ci/core/common/common-auth/common-auth-api/src/main/kotlin/com/tencent/devops/common/auth/api/pojo/BkAuthGroupAndUserList.kt index e7c72313ca7..85836df0c8c 100644 --- a/src/backend/ci/core/common/common-auth/common-auth-api/src/main/kotlin/com/tencent/devops/common/auth/api/pojo/BkAuthGroupAndUserList.kt +++ b/src/backend/ci/core/common/common-auth/common-auth-api/src/main/kotlin/com/tencent/devops/common/auth/api/pojo/BkAuthGroupAndUserList.kt @@ -28,6 +28,7 @@ package com.tencent.devops.common.auth.api.pojo import com.fasterxml.jackson.annotation.JsonProperty +import com.tencent.bk.sdk.iam.dto.manager.RoleGroupMemberInfo data class BkAuthGroupAndUserList( @JsonProperty("display_name") @@ -38,6 +39,8 @@ data class BkAuthGroupAndUserList( val roleName: String, @JsonProperty("user_id_list") val userIdList: List, + @JsonProperty("dept_info_list") + val deptInfoList: List? = null, @JsonProperty("type") val type: String )