Skip to content

Commit bd9d4f7

Browse files
authored
Merge pull request #6410 from devtron-labs/fix-sub-user
misc: pipeline listing in app Group
2 parents e15611c + fa14d98 commit bd9d4f7

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

pkg/pipeline/CdHandler.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,11 +1056,12 @@ func (impl *CdHandlerImpl) FetchAppWorkflowStatusForTriggerViewForEnvironment(re
10561056
appObjectArr = append(appObjectArr, object[0])
10571057
envObjectArr = append(envObjectArr, object[1])
10581058
}
1059-
appResults, envResults := request.CheckAuthBatch(token, appObjectArr, envObjectArr)
1059+
1060+
// filter out pipelines for unauthorized apps but not envs
1061+
appResults, _ := request.CheckAuthBatch(token, appObjectArr, envObjectArr)
10601062
for _, pipeline := range pipelines {
10611063
appObject := objects[pipeline.Id][0]
1062-
envObject := objects[pipeline.Id][1]
1063-
if !(appResults[appObject] && envResults[envObject]) {
1064+
if !(appResults[appObject]) {
10641065
// if user unauthorized, skip items
10651066
continue
10661067
}

pkg/pipeline/DeploymentPipelineConfigService.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,21 +1183,23 @@ func (impl *CdPipelineConfigServiceImpl) GetCdPipelinesByEnvironment(request res
11831183
appObjectArr = append(appObjectArr, object[0])
11841184
envObjectArr = append(envObjectArr, object[1])
11851185
}
1186-
appResults, envResults := request.CheckAuthBatch(token, appObjectArr, envObjectArr)
1187-
//authorization block ends here
1186+
1187+
// filter out pipelines for unauthorized apps but not envs
1188+
appResults, _ := request.CheckAuthBatch(token, appObjectArr, envObjectArr)
1189+
11881190
span.End()
11891191
var pipelines []*bean.CDPipelineConfigObject
11901192
authorizedPipelines := make(map[int]*bean.CDPipelineConfigObject)
11911193
for _, dbPipeline := range cdPipelines.Pipelines {
11921194
appObject := objects[dbPipeline.Id][0]
1193-
envObject := objects[dbPipeline.Id][1]
1194-
if !(appResults[appObject] && envResults[envObject]) {
1195+
if !(appResults[appObject]) {
11951196
//if user unauthorized, skip items
11961197
continue
11971198
}
11981199
pipelineIds = append(pipelineIds, dbPipeline.Id)
11991200
authorizedPipelines[dbPipeline.Id] = dbPipeline
12001201
}
1202+
//authorization block ends here
12011203

12021204
pipelineDeploymentTemplate := make(map[int]chartRepoRepository.DeploymentStrategy)
12031205
pipelineWorkflowMapping := make(map[int]*appWorkflow.AppWorkflowMapping)

0 commit comments

Comments
 (0)