Merge pull request #15238 from chlins/fix/create-p2p-policy-permission

fix(p2p): fix p2p create policy permission
This commit is contained in:
Steven Zou 2021-07-05 11:04:28 +08:00 committed by GitHub
commit 4ddaecdc3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -237,6 +237,13 @@ func (api *preheatAPI) CreatePolicy(ctx context.Context, params operation.Create
return api.SendError(ctx, err)
}
project, err := api.projectCtl.GetByName(ctx, params.ProjectName)
if err != nil {
return api.SendError(ctx, err)
}
// override project ID
policy.ProjectID = project.ProjectID
_, err = api.preheatCtl.CreatePolicy(ctx, policy)
if err != nil {
return api.SendError(ctx, err)