Skip to content

Commit

Permalink
fix(api): import pipeline without permission via ascode create it wit…
Browse files Browse the repository at this point in the history
…h right permissions (#3245)

close #3232
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
  • Loading branch information
bnjjj authored and yesnault committed Aug 22, 2018
1 parent 016369c commit 6ebf1b3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion engine/api/pipeline/pipeline_importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func importNew(db gorp.SqlExecutor, store cache.Store, proj *sdk.Project, pip *s
}

//If no GroupPermission provided, inherit from project
if pip.GroupPermission == nil {
if pip.GroupPermission == nil || len(pip.GroupPermission) == 0 {
pip.GroupPermission = proj.ProjectGroups
}

Expand Down
6 changes: 1 addition & 5 deletions engine/api/pipeline_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,11 @@ func (api *API) importPipelineHandler() service.Handler {
forceUpdate := FormBool(r, "forceUpdate")

// Load project
proj, errp := project.Load(api.mustDB(), api.Cache, key, getUser(ctx), project.LoadOptions.Default)
proj, errp := project.Load(api.mustDB(), api.Cache, key, getUser(ctx), project.LoadOptions.Default, project.LoadOptions.WithGroups)
if errp != nil {
return sdk.WrapError(errp, "importPipelineHandler> Unable to load project %s", key)
}

if err := group.LoadGroupByProject(api.mustDB(), proj); err != nil {
return sdk.WrapError(err, "importPipelineHandler> Unable to load project permissions %s", key)
}

// Get body
data, errRead := ioutil.ReadAll(r.Body)
if errRead != nil {
Expand Down

0 comments on commit 6ebf1b3

Please sign in to comment.