From dc65c837d6a48455160d3d25a75fb3efc2cc1e17 Mon Sep 17 00:00:00 2001 From: greysonfang Date: Fri, 15 Nov 2024 14:44:09 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E7=94=A8=E6=88=B7=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E5=8A=A0=E5=85=A5=E7=BB=84=E4=BC=98=E5=8C=96=20#11219?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rbac/service/RbacPermissionApplyService.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/provider/rbac/service/RbacPermissionApplyService.kt b/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/provider/rbac/service/RbacPermissionApplyService.kt index e5ff247f4909..63e94d7445bb 100644 --- a/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/provider/rbac/service/RbacPermissionApplyService.kt +++ b/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/provider/rbac/service/RbacPermissionApplyService.kt @@ -32,6 +32,7 @@ import com.tencent.devops.auth.service.iam.PermissionService import com.tencent.devops.common.api.exception.ErrorCodeException import com.tencent.devops.common.api.exception.OperationException import com.tencent.devops.common.api.util.DateTimeUtil +import com.tencent.devops.common.api.util.timestamp import com.tencent.devops.common.auth.api.AuthPermission import com.tencent.devops.common.auth.api.AuthResourceType import com.tencent.devops.common.auth.api.pojo.DefaultGroupType @@ -48,6 +49,7 @@ import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Value import java.net.URLEncoder +import java.time.LocalDateTime import java.util.concurrent.Executors import java.util.concurrent.Future @@ -264,6 +266,13 @@ class RbacPermissionApplyService @Autowired constructor( val resourceTypeName = rbacCacheService.getResourceTypeInfo(resourceType).name val resourceName = dbGroupRecord?.resourceName ?: projectName val resourceCode = dbGroupRecord?.resourceCode ?: projectId + val memberJoinedResult = verifyMemberJoinedResult[gInfo.id.toInt()] + val isMemberJoinedGroup = when { + memberJoinedResult?.belong == true && + memberJoinedResult.expiredAt > LocalDateTime.now().timestamp() -> true + + else -> false + } ManagerRoleGroupInfo( id = gInfo.id, name = gInfo.name, @@ -271,7 +280,7 @@ class RbacPermissionApplyService @Autowired constructor( readonly = gInfo.readonly, userCount = gInfo.userCount, departmentCount = gInfo.departmentCount, - joined = verifyMemberJoinedResult[gInfo.id.toInt()]?.belong ?: false, + joined = isMemberJoinedGroup, resourceType = resourceType, resourceTypeName = resourceTypeName, resourceName = resourceName,