From 2b4ffd2881fc283fad5a2d4bd9e65f4915352dee Mon Sep 17 00:00:00 2001 From: greysonfang Date: Mon, 21 Oct 2024 17:14:26 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=90=8C=E6=AD=A5=E5=B9=B6?= =?UTF-8?q?=E5=88=86=E8=A1=A8=E5=AD=98=E5=82=A8=E8=B5=84=E6=BA=90=E7=BB=84?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=95=B0=E6=8D=AE=20#10964?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tencent/devops/auth/dao/AuthAuthorizationDao.kt | 1 + .../devops/auth/dao/AuthResourceGroupPermissionDao.kt | 3 ++- .../RbacPermissionResourceGroupPermissionService.kt | 10 ++++++++-- .../resources/UserAuthResourceGroupSyncResourceImpl.kt | 5 ++++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/dao/AuthAuthorizationDao.kt b/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/dao/AuthAuthorizationDao.kt index 178cfcf5073..dca6f34e966 100644 --- a/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/dao/AuthAuthorizationDao.kt +++ b/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/dao/AuthAuthorizationDao.kt @@ -79,6 +79,7 @@ class AuthAuthorizationDao { } } + @Suppress("NestedBlockDepth") fun batchUpdate( dslContext: DSLContext, resourceAuthorizationHandoverList: List diff --git a/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/dao/AuthResourceGroupPermissionDao.kt b/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/dao/AuthResourceGroupPermissionDao.kt index dfcf3f8dd5c..4eb94a340c0 100644 --- a/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/dao/AuthResourceGroupPermissionDao.kt +++ b/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/dao/AuthResourceGroupPermissionDao.kt @@ -230,7 +230,8 @@ class AuthResourceGroupPermissionDao { } } .let { - if (resourceType == AuthResourceType.PIPELINE_DEFAULT.value && pipelineGroupIds.isNotEmpty()) { + if (resourceType == AuthResourceType.PIPELINE_DEFAULT.value && + pipelineGroupIds.isNotEmpty()) { it.or( RELATED_RESOURCE_TYPE.eq(AuthResourceType.PIPELINE_GROUP.value) .and(RELATED_RESOURCE_CODE.`in`(pipelineGroupIds)) diff --git a/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/provider/rbac/service/RbacPermissionResourceGroupPermissionService.kt b/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/provider/rbac/service/RbacPermissionResourceGroupPermissionService.kt index 8cb9815562f..eb461b5bbb5 100644 --- a/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/provider/rbac/service/RbacPermissionResourceGroupPermissionService.kt +++ b/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/provider/rbac/service/RbacPermissionResourceGroupPermissionService.kt @@ -457,12 +457,18 @@ class RbacPermissionResourceGroupPermissionService( } }.distinct() - val oldResourceGroupPermissions = resourceGroupPermissionDao.listByGroupId(dslContext, projectCode, iamGroupId) + val oldResourceGroupPermissions = resourceGroupPermissionDao.listByGroupId( + dslContext = dslContext, + projectCode = projectCode, + iamGroupId = iamGroupId + ) val toDeleteRecords = oldResourceGroupPermissions.filter { it !in latestResourceGroupPermissions } val toAddRecords = latestResourceGroupPermissions.filter { it !in oldResourceGroupPermissions }.map { it.copy( - id = client.get(ServiceAllocIdResource::class).generateSegmentId(AUTH_RESOURCE_GROUP_PERMISSION_ID_TAG).data!! + id = client.get(ServiceAllocIdResource::class).generateSegmentId( + bizTag = AUTH_RESOURCE_GROUP_PERMISSION_ID_TAG + ).data!! ) } dslContext.transaction { configuration -> diff --git a/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/resources/UserAuthResourceGroupSyncResourceImpl.kt b/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/resources/UserAuthResourceGroupSyncResourceImpl.kt index 2aea76634f3..4a98618ce51 100644 --- a/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/resources/UserAuthResourceGroupSyncResourceImpl.kt +++ b/src/backend/ci/core/auth/biz-auth/src/main/kotlin/com/tencent/devops/auth/resources/UserAuthResourceGroupSyncResourceImpl.kt @@ -65,7 +65,10 @@ class UserAuthResourceGroupSyncResourceImpl @Autowired constructor( override fun deleteGroupPermissions(userId: String, projectId: String, groupId: Int): Result { return Result( - permissionResourceGroupPermissionService.deleteByGroupIds(projectCode = projectId, iamGroupIds = listOf(groupId)) + permissionResourceGroupPermissionService.deleteByGroupIds( + projectCode = projectId, + iamGroupIds = listOf(groupId) + ) ) } }