Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pkg/pipeline/CdHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1056,11 +1056,12 @@ func (impl *CdHandlerImpl) FetchAppWorkflowStatusForTriggerViewForEnvironment(re
appObjectArr = append(appObjectArr, object[0])
envObjectArr = append(envObjectArr, object[1])
}
appResults, envResults := request.CheckAuthBatch(token, appObjectArr, envObjectArr)

// filter out pipelines for unauthorized apps but not envs
appResults, _ := request.CheckAuthBatch(token, appObjectArr, envObjectArr)
for _, pipeline := range pipelines {
appObject := objects[pipeline.Id][0]
envObject := objects[pipeline.Id][1]
if !(appResults[appObject] && envResults[envObject]) {
if !(appResults[appObject]) {
// if user unauthorized, skip items
continue
}
Expand Down
10 changes: 6 additions & 4 deletions pkg/pipeline/DeploymentPipelineConfigService.go
Original file line number Diff line number Diff line change
Expand Up @@ -1183,21 +1183,23 @@ func (impl *CdPipelineConfigServiceImpl) GetCdPipelinesByEnvironment(request res
appObjectArr = append(appObjectArr, object[0])
envObjectArr = append(envObjectArr, object[1])
}
appResults, envResults := request.CheckAuthBatch(token, appObjectArr, envObjectArr)
//authorization block ends here

// filter out pipelines for unauthorized apps but not envs
appResults, _ := request.CheckAuthBatch(token, appObjectArr, envObjectArr)

span.End()
var pipelines []*bean.CDPipelineConfigObject
authorizedPipelines := make(map[int]*bean.CDPipelineConfigObject)
for _, dbPipeline := range cdPipelines.Pipelines {
appObject := objects[dbPipeline.Id][0]
envObject := objects[dbPipeline.Id][1]
if !(appResults[appObject] && envResults[envObject]) {
if !(appResults[appObject]) {
//if user unauthorized, skip items
continue
}
pipelineIds = append(pipelineIds, dbPipeline.Id)
authorizedPipelines[dbPipeline.Id] = dbPipeline
}
//authorization block ends here

pipelineDeploymentTemplate := make(map[int]chartRepoRepository.DeploymentStrategy)
pipelineWorkflowMapping := make(map[int]*appWorkflow.AppWorkflowMapping)
Expand Down
Loading