Skip to content

Commit

Permalink
fix(api): filter on groups on /worker/enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux authored and richardlt committed Jan 17, 2020
1 parent 4a2d850 commit 7ec11da
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions engine/api/worker_model_hatchery.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,13 @@ func (api *API) getWorkerModelsEnabledHandler() service.Handler {
if !ok {
return sdk.WithStack(sdk.ErrForbidden)
}

var groupIDs = append(getAPIConsumer(ctx).GetGroupIDs(), group.SharedInfraGroup.ID)
consumer := getAPIConsumer(ctx)
var groupIDs []int64
if len(consumer.GroupIDs) > 0 {
groupIDs = consumer.GroupIDs
} else {
groupIDs = append(getAPIConsumer(ctx).GetGroupIDs(), group.SharedInfraGroup.ID)
}

// for an hatchery the token was generated by a admin for all consumer's groups.
models, err := workermodel.LoadAllUsableWithClearPasswordByGroupIDs(api.mustDB(), groupIDs)
Expand Down

0 comments on commit 7ec11da

Please sign in to comment.