Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
10 changes: 6 additions & 4 deletions engine/api/workflow_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,12 +741,12 @@ func (api *API) getWorkflowJobQueueHandler() service.Handler {
return errM
}

permissions := sdk.PermissionReadExecute
permissions := sdk.PermissionRead

isW := isWorker(ctx)
isS := isService(ctx)
if !isW && !isS {
permissions = sdk.PermissionRead
if isW || isS {
permissions = sdk.PermissionReadExecute
}

filter := workflow.NewQueueFilter()
Expand All @@ -759,8 +759,10 @@ func (api *API) getWorkflowJobQueueHandler() service.Handler {
if modelType != "" {
filter.ModelType = []string{modelType}
}

var jobs []sdk.WorkflowNodeJobRun
if !isMaintainer(ctx) && !isAdmin(ctx) {
// If the consumer is a worker, a hatchery or a non maintainer user, filter the job by its groups
if isW || isS || !isMaintainer(ctx) {
jobs, err = workflow.LoadNodeJobRunQueueByGroupIDs(ctx, api.mustDB(), api.Cache, filter, getAPIConsumer(ctx).GetGroupIDs())
} else {
jobs, err = workflow.LoadNodeJobRunQueue(ctx, api.mustDB(), api.Cache, filter)
Expand Down