Skip to content

Commit

Permalink
Merge pull request #11220 from fcfang123/issue-11219
Browse files Browse the repository at this point in the history
feat:用户申请加入组优化 #11219
  • Loading branch information
bkci-bot authored Nov 15, 2024
2 parents f5bd3f0 + dc65c83 commit b52da2d
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -264,14 +266,21 @@ 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,
description = gInfo.description,
readonly = gInfo.readonly,
userCount = gInfo.userCount,
departmentCount = gInfo.departmentCount,
joined = verifyMemberJoinedResult[gInfo.id.toInt()]?.belong ?: false,
joined = isMemberJoinedGroup,
resourceType = resourceType,
resourceTypeName = resourceTypeName,
resourceName = resourceName,
Expand Down

0 comments on commit b52da2d

Please sign in to comment.