fix(p2p): fix p2p create policy permission

Signed-off-by: chlins <chlins.zhang@gmail.com>
This commit is contained in:
chlins 2021-07-01 16:14:26 +08:00
parent 4e1f6633af
commit f1456558db

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)