Skip to content

Commit

Permalink
bug:修改分级管理员授权范围偶现不成功现象 #11334
Browse files Browse the repository at this point in the history
  • Loading branch information
fcfang123 committed Jan 7, 2025
1 parent 7982b51 commit 84e6cf8
Showing 1 changed file with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import com.tencent.devops.common.auth.api.pojo.ProjectConditionDTO
import com.tencent.devops.common.auth.api.pojo.ResourceRegisterInfo
import com.tencent.devops.common.auth.api.pojo.SubjectScopeInfo
import com.tencent.devops.common.auth.code.ProjectAuthServiceCode
import com.tencent.devops.common.auth.enums.SubjectScopeType
import com.tencent.devops.common.client.Client
import com.tencent.devops.common.client.ClientTokenService
import com.tencent.devops.common.event.dispatcher.SampleEventDispatcher
Expand Down Expand Up @@ -766,9 +767,27 @@ abstract class AbsProjectServiceImpl @Autowired constructor(
beforeSubjectScopes: List<SubjectScopeInfo>,
afterSubjectScopes: List<SubjectScopeInfo>
): Boolean {
val beforeIds = beforeSubjectScopes.map { it.id }.toSet()
val afterIds = afterSubjectScopes.map { it.id }.toSet()
return beforeIds != afterIds
val beforeUsernames = beforeSubjectScopes
.filter { it.type == SubjectScopeType.USER.value }
.map { it.username }
.toSet()

val afterUsernames = afterSubjectScopes
.filter { it.type == SubjectScopeType.USER.value }
.map { it.username }
.toSet()

val beforeDeptIds = beforeSubjectScopes
.filter { it.type != SubjectScopeType.USER.value }
.map { it.id }
.toSet()

val afterDeptIds = afterSubjectScopes
.filter { it.type != SubjectScopeType.USER.value }
.map { it.id }
.toSet()

return beforeUsernames != afterUsernames || beforeDeptIds != afterDeptIds
}

private fun updateApprovalInfo(
Expand Down

0 comments on commit 84e6cf8

Please sign in to comment.