Skip to content

Commit 8a6f308

Browse files
authored
fix(api): getWorkflowJobQueueHandler filter by group for all hatcheries (#5079)
Signed-off-by: francois samin <[email protected]>
1 parent 4feb0fe commit 8a6f308

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

engine/api/workflow_queue.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -741,12 +741,12 @@ func (api *API) getWorkflowJobQueueHandler() service.Handler {
741741
return errM
742742
}
743743

744-
permissions := sdk.PermissionReadExecute
744+
permissions := sdk.PermissionRead
745745

746746
isW := isWorker(ctx)
747747
isS := isService(ctx)
748-
if !isW && !isS {
749-
permissions = sdk.PermissionRead
748+
if isW || isS {
749+
permissions = sdk.PermissionReadExecute
750750
}
751751

752752
filter := workflow.NewQueueFilter()
@@ -759,8 +759,10 @@ func (api *API) getWorkflowJobQueueHandler() service.Handler {
759759
if modelType != "" {
760760
filter.ModelType = []string{modelType}
761761
}
762+
762763
var jobs []sdk.WorkflowNodeJobRun
763-
if !isMaintainer(ctx) && !isAdmin(ctx) {
764+
// If the consumer is a worker, a hatchery or a non maintainer user, filter the job by its groups
765+
if isW || isS || !isMaintainer(ctx) {
764766
jobs, err = workflow.LoadNodeJobRunQueueByGroupIDs(ctx, api.mustDB(), api.Cache, filter, getAPIConsumer(ctx).GetGroupIDs())
765767
} else {
766768
jobs, err = workflow.LoadNodeJobRunQueue(ctx, api.mustDB(), api.Cache, filter)

0 commit comments

Comments
 (0)