Skip to content

Commit

Permalink
feat:同步并分表存储资源组权限数据 TencentBlueKing#10964
Browse files Browse the repository at this point in the history
  • Loading branch information
fcfang123 committed Oct 21, 2024
1 parent b660714 commit 884d1a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -466,19 +466,23 @@ class RbacPermissionResourceMemberService(
page = 1
}
val groupMemberInfoList = iamV2ManagerService.getRoleGroupMemberV2(groupInfo.id, pageInfoDTO).results
val members = mutableListOf<String>()

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 = ""
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -38,6 +39,8 @@ data class BkAuthGroupAndUserList(
val roleName: String,
@JsonProperty("user_id_list")
val userIdList: List<String>,
@JsonProperty("dept_info_list")
val deptInfoList: List<RoleGroupMemberInfo>? = null,
@JsonProperty("type")
val type: String
)

0 comments on commit 884d1a1

Please sign in to comment.