Skip to content

Commit

Permalink
fix(api): missing members on group for template perm check (#4904)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardlt authored and yesnault committed Jan 20, 2020
1 parent 46d6e99 commit 3ccb3a1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions engine/api/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (api *API) putTemplateHandler() service.Handler {
groupName := vars["permGroupName"]
templateSlug := vars["permTemplateSlug"]

g, err := group.LoadByName(ctx, api.mustDB(), groupName)
g, err := group.LoadByName(ctx, api.mustDB(), groupName, group.LoadOptions.WithMembers)
if err != nil {
return err
}
Expand Down Expand Up @@ -398,7 +398,7 @@ func (api *API) postTemplateApplyHandler() service.Handler {
groupName := vars["groupName"]
templateSlug := vars["templateSlug"]

g, err := group.LoadByName(ctx, api.mustDB(), groupName)
g, err := group.LoadByName(ctx, api.mustDB(), groupName, group.LoadOptions.WithMembers)
if err != nil {
return err
}
Expand Down Expand Up @@ -485,7 +485,7 @@ func (api *API) postTemplateBulkHandler() service.Handler {
groupName := vars["groupName"]
templateSlug := vars["templateSlug"]

g, err := group.LoadByName(ctx, api.mustDB(), groupName)
g, err := group.LoadByName(ctx, api.mustDB(), groupName, group.LoadOptions.WithMembers)
if err != nil {
return err
}
Expand Down Expand Up @@ -637,7 +637,7 @@ func (api *API) getTemplateBulkHandler() service.Handler {
groupName := vars["groupName"]
templateSlug := vars["templateSlug"]

g, err := group.LoadByName(ctx, api.mustDB(), groupName)
g, err := group.LoadByName(ctx, api.mustDB(), groupName, group.LoadOptions.WithMembers)
if err != nil {
return err
}
Expand Down Expand Up @@ -672,7 +672,7 @@ func (api *API) getTemplateInstancesHandler() service.Handler {
groupName := vars["groupName"]
templateSlug := vars["templateSlug"]

g, err := group.LoadByName(ctx, api.mustDB(), groupName)
g, err := group.LoadByName(ctx, api.mustDB(), groupName, group.LoadOptions.WithMembers)
if err != nil {
return err
}
Expand Down Expand Up @@ -761,7 +761,7 @@ func (api *API) deleteTemplateInstanceHandler() service.Handler {
groupName := vars["groupName"]
templateSlug := vars["templateSlug"]

g, err := group.LoadByName(ctx, api.mustDB(), groupName)
g, err := group.LoadByName(ctx, api.mustDB(), groupName, group.LoadOptions.WithMembers)
if err != nil {
return err
}
Expand Down Expand Up @@ -812,7 +812,7 @@ func (api *API) postTemplatePullHandler() service.Handler {
groupName := vars["permGroupName"]
templateSlug := vars["permTemplateSlug"]

g, err := group.LoadByName(ctx, api.mustDB(), groupName)
g, err := group.LoadByName(ctx, api.mustDB(), groupName, group.LoadOptions.WithMembers)
if err != nil {
return err
}
Expand Down Expand Up @@ -855,7 +855,7 @@ func (api *API) postTemplatePushHandler() service.Handler {
}

// check that the user is admin on the given template's group
grp, err := group.LoadByName(ctx, api.mustDB(), wt.Group.Name)
grp, err := group.LoadByName(ctx, api.mustDB(), wt.Group.Name, group.LoadOptions.WithMembers)
if err != nil {
return sdk.NewError(sdk.ErrWrongRequest, err)
}
Expand Down Expand Up @@ -924,7 +924,7 @@ func (api *API) getTemplateUsageHandler() service.Handler {
groupName := vars["groupName"]
templateSlug := vars["templateSlug"]

g, err := group.LoadByName(ctx, api.mustDB(), groupName)
g, err := group.LoadByName(ctx, api.mustDB(), groupName, group.LoadOptions.WithMembers)
if err != nil {
return err
}
Expand Down

0 comments on commit 3ccb3a1

Please sign in to comment.