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
16 changes: 16 additions & 0 deletions api/cluster/EnvironmentRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,22 @@ func (impl EnvironmentRestHandlerImpl) GetAll(w http.ResponseWriter, r *http.Req
return
}

userId, err := impl.userService.GetLoggedInUser(r)
if userId == 0 || err != nil {
common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized)
return
}
isSuperAdmin, err := impl.userService.IsSuperAdmin(int(userId))
if err != nil {
impl.logger.Errorw("request err, GetAll", "err", err, "userId", userId)
common.WriteJsonResp(w, err, "Failed to check is super admin", http.StatusInternalServerError)
return
}
if isSuperAdmin {
common.WriteJsonResp(w, err, environments, http.StatusOK)
return
}

token := r.Header.Get("token")
emailId, err := impl.userService.GetEmailFromToken(token)
if err != nil {
Expand Down
10 changes: 9 additions & 1 deletion pkg/pipeline/WorkflowDagExecutor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,9 @@ func (impl *WorkflowDagExecutorImpl) TriggerDeployment(cdWf *pipelineConfig.CdWo
if err != nil {
return err
}

runner.CdWorkflow = &pipelineConfig.CdWorkflow{
Pipeline: pipeline,
}
// creating cd pipeline status timeline for deployment initialisation
timeline := &pipelineConfig.PipelineStatusTimeline{
CdWorkflowRunnerId: runner.Id,
Expand Down Expand Up @@ -1380,6 +1382,9 @@ func (impl *WorkflowDagExecutorImpl) ManualCdTrigger(overrideRequest *bean.Value
impl.logger.Errorw("err", "err", err)
return 0, err
}
runner.CdWorkflow = &pipelineConfig.CdWorkflow{
Pipeline: cdPipeline,
}
overrideRequest.CdWorkflowId = cdWorkflowId
// creating cd pipeline status timeline for deployment initialisation
timeline := &pipelineConfig.PipelineStatusTimeline{
Expand Down Expand Up @@ -1452,6 +1457,9 @@ func (impl *WorkflowDagExecutorImpl) ManualCdTrigger(overrideRequest *bean.Value
impl.logger.Errorw("err", "err", err)
return 0, err
}
runner.CdWorkflow = &pipelineConfig.CdWorkflow{
Pipeline: cdPipeline,
}
cdMetrics := util4.CDMetrics{
AppName: runner.CdWorkflow.Pipeline.DeploymentAppName,
Status: runner.Status,
Expand Down