Skip to content

Commit

Permalink
Merge pull request #238 from cnlkl/issue_229
Browse files Browse the repository at this point in the history
修复制品分报告页面非管理员无权限访问
  • Loading branch information
owenlxu authored Mar 1, 2023
2 parents 16f6a25 + 7040270 commit 578dd3f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ data class SubtaskResultOverview(
val scanner: String,
@ApiModelProperty("扫描器类型")
val scannerType: String,
@ApiModelProperty("扫描类型")
val scanTypes: List<String> = emptyList(),

@ApiModelProperty("制品名")
val name: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ class ScanTaskServiceImpl(
logger.info("Failed to checkSubtaskPermission: ", e)
permissionCheckHandler.checkProjectPermission(subtask.projectId, PermissionAction.MANAGE)
}
return Converter.convert(subtask)
val scanTypes = subtask.planId?.let { scanPlanDao.findById(it) }?.scanTypes ?: emptyList()
return Converter.convert(subtask, scanTypes)
}

private fun subtasks(request: SubtaskInfoRequest, subtaskDao: AbsSubScanTaskDao<*>): Page<SubtaskInfo> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ object Converter {
}
}

fun convert(subScanTask: SubScanTaskDefinition): SubtaskResultOverview {
fun convert(subScanTask: SubScanTaskDefinition, scanTypes: List<String>): SubtaskResultOverview {
return with(subScanTask) {
val critical = getCveCount(Level.CRITICAL.levelName, subScanTask)
val high = getCveCount(Level.HIGH.levelName, subScanTask)
Expand All @@ -130,6 +130,7 @@ object Converter {
subTaskId = subScanTask.id!!,
scanner = scanner,
scannerType = scannerType,
scanTypes = scanTypes,
name = artifactName,
packageKey = packageKey,
version = version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,14 @@
}
},
created () {
this.getScanConfig({ projectId: this.projectId, id: this.planId })
.then(res => {
this.scanTypes = res.scanTypes
this.panels = res.scanTypes.map(scanType => this.allPanels[scanType])
})
this.artiReportOverview({
projectId: this.projectId,
recordId: this.recordId,
taskId: this.taskId,
viewType: this.viewType
}).then(res => {
this.scanTypes = res.scanTypes
this.panels = res.scanTypes.map(scanType => this.allPanels[scanType])
this.subtaskOverview = {
...res,
highestLeakLevel: leakLevelEnum[res.highestLeakLevel],
Expand Down

0 comments on commit 578dd3f

Please sign in to comment.