Skip to content

Commit

Permalink
feat : 修复权限校验bug TencentBlueKing#2375
Browse files Browse the repository at this point in the history
* feat : 修复权限校验bug TencentBlueKing#2375

* feat : 修复权限校验bug TencentBlueKing#2375

* feat : 修复权限校验bug TencentBlueKing#2375

* feat : 修复权限校验bug TencentBlueKing#2375

* feat : 修复权限校验bug TencentBlueKing#2375
  • Loading branch information
owenlxu authored Jul 11, 2024
1 parent b43230f commit d606119
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ import com.tencent.bkrepo.auth.constant.PIPELINE
import com.tencent.bkrepo.auth.constant.REPORT
import com.tencent.bkrepo.auth.dao.PersonalPathDao
import com.tencent.bkrepo.auth.dao.RepoAuthConfigDao
import com.tencent.bkrepo.auth.pojo.enums.PermissionAction.DOWNLOAD
import com.tencent.bkrepo.auth.pojo.enums.PermissionAction.VIEW
import com.tencent.bkrepo.auth.pojo.enums.PermissionAction.WRITE
import com.tencent.bkrepo.auth.pojo.enums.PermissionAction.MANAGE
import com.tencent.bkrepo.auth.pojo.enums.PermissionAction.READ
import com.tencent.bkrepo.auth.pojo.enums.ResourceType.NODE
Expand Down Expand Up @@ -194,19 +197,26 @@ class DevopsPermissionServiceImpl constructor(
return false
}
when (repoName) {
CUSTOM, LOG, REPORT -> {
CUSTOM, LOG -> {
return checkDevopsCustomPermission(request)
}
PIPELINE -> {
return checkDevopsPipelinePermission(request)
}
REPORT -> {
return checkDevopsReportPermission(request.action)
}
else -> {
return checkRepoNotInDevops(request)
}
}
}
}

private fun checkDevopsReportPermission(action: String): Boolean {
return action == READ.name || action == WRITE.name || action == VIEW.name || action == DOWNLOAD.name
}

private fun checkDevopsCustomPermission(request: CheckPermissionRequest): Boolean {
logger.debug("check devops custom permission request [$request]")
with(request) {
Expand Down

0 comments on commit d606119

Please sign in to comment.